_ = 0 : dt : t_real;
    [X_, T_] = meshgrid(x_, t_);
    u = zeros(size(X_));
    u(1, :) = f_(x_);
    u(:, M + 1) = b;
    <span class="keyword">for</span> jj = 1 : N
        u(jj + 1, 1) = (1 - 2 * r) * u(jj, 1) + 2 * r * u(jj, 2);
        <span class="keyword">for</span> kk = 2 : M
            u(jj + 1, kk) = (1 - 2 * r) * u(jj, kk) <span class="keyword">...</span>
                + r * (u(jj, kk - 1) + u(jj, kk + 1));
        <span class="keyword">end</span>
    <span class="keyword">end</span>
    u_