: 1;
t_ = 0 : dt : t;
[X_, T_] = meshgrid(x_, t_);
f = f_(x_);
u = zeros(size(X_));
u(1, :) = f;
u(:, 1) = 0; u(:, M + 1) = 0;

va = (-r + s) * ones(1, M - 2);
vc = (-r - s) * ones(1, M - 2);
vb = bsxfun(@plus, ones(1, M - 1), r * 2);

<span class="keyword">for</span> jj = 1 : N - 1
    u(jj + 1, 2 : end - 1) = thomas_algo(va, vb, vc, u(jj, 2 : end - 1))';
<span class="keyword">end</span>
figure; mesh(X_, T_, u);
xlabel(<span class="string">'x'</span>); ylabel(<span class="string">'t'</span>); zlabel(<span 