% create a rectangular function u0 = zeros(1,100); u0(40:60) =1; % run the diffusion K = 1, mu = 0, dt = 0.1, nt = 10 [x,u] = diff1d_implicit(0,100,u0,1,0,2,11); % plot the evolution of the rectangle figure hold for k = 1:10 plot(x,u(:,k)); end