
ax = 1.;
bt = 0.6;
nx = 20;
%mt = 510;  % for forward difference only, runs ok
%mt = 500;  % for forward difference only, explodes
mt = 20;
alpha = 1.;

myfun = @(v) sin(pi*v);

tic
%[uu, xx, tt] = myfd1diffor(alpha, myfun, ax, bt, nx, mt);
[uu, xx, tt] = myfd1difbak(alpha, myfun, ax, bt, nx, mt);
toc

% Plot solution
%surf(xx, tt, uu');
surf(xx(1:mt/20:mt,:),tt(1:mt/20:mt,:),uu(:,1:mt/20:mt)')
dx = xx(1,2) - xx(1,1);
dt = tt(2,1) - tt(1,1);
title(strcat('Diffusion Equation: dx=', num2str(dx), ' , dt=', num2str(dt)));
xlabel('x');
ylabel('t');
zlabel('u(x,t)');
