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