;
[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);

for jj = 1 : N - 1
    d = (r + s) * u(jj, 1 : M - 1) + ...
        (1 - 2 * r) * u(jj, 2 : M) + ...
        (r - s) * u(jj, 3 : M + 1);
    d(1) = d(1) + (r + s) * 0;
    d(end) = d(end) + (r - s) * 0;
    u(jj + 1, 2 : end - 1) = thomas_algo(va, vb, vc, u(jj, 2 : end - 1))';
end
u_slice_2 = u(