t_0 = 0; t_f = 1; N = 128; M = 100; [u1,err,x,t1] = heat1(t_0,t_f,M,N); figure(1) for j=0:20 plot(x,u1(:,j+1),'.-') title(t1(j+1),'FontSize',16) xlabel('Explicit Euler','FontSize',16) pause(1) end figure(2) plot(t1,log10(max(abs(u1)))) title('log10(maximum of u) versus time','FontSize',16) xlabel('notice that things start to grow exponentially shortly before time 0.2') display('hit any key for more') pause figure(1) for j=0:20 [k,amp] = find_spec(u1(1:N,j+1)); plot(k,amp,'.-') axis([0,N/2,-17,2]) pause(1) end display('hit any key for more') pause [u2,err,x,t1] = heat3(t_0,t_f,M,N); figure(1) for j=0:20 plot(x,u2(:,j+1),'.-') title(t1(j+1),'FontSize',16) xlabel('Fully implicit','FontSize',16) pause(1) end figure(2) plot(t1,log10(max(abs(u2)))) title('log10(maximum of u) versus time','FontSize',16) display('hit any key for more') pause figure(1) for j=0:20 [k,amp] = find_spec(u2(1:N,j+1)); plot(k,amp,'.-') axis([0,N/2,-17,2]) pause(1) end display('hit any key for more') pause [u3,err,x,t1] = heat_cn(t_0,t_f,M,N); figure(1) for j=0:20 plot(x,u3(:,j+1),'.-') title(t1(j+1),'FontSize',16) xlabel('Fully implicit','FontSize',16) pause(1) end figure(2) plot(t1,log10(max(abs(u3)))) title('log10(maximum of u) versus time','FontSize',16) display('hit any key for more') pause figure(1) for j=0:20 [k,amp] = find_spec(u3(1:N,j+1)); plot(k,amp,'.-') axis([0,N/2,-17,2]) pause(1) end