Partial differential equations 427
27 %to see what’s going on, let’s use a different initial …
condition
28 g = figure;
29 dx = 0.01;
40 xlabel(‘$x$’,‘FontSize’,14)
41 ylabel(‘$c$’,‘FontSize’,14)
42 legend(‘0’,‘0.0005’,‘0.01’,‘0.05’,‘0.07’,‘0.2’,…
43 ‘Location’,‘SouthEast’)
44 saveas(g,‘s15h11p3 solution figure2.eps’,‘psc2’)
54 tic
55 [x,cplot] = get c(dx,c,tplot);
56 t = toc;
57 fprintf(‘Completed in %4.2f seconds.\n’,t)
58 plot(x,cplot)
69 x = linspace(0,1,n); %grid for x positions
70 A = writeA(dt,dx,n); %write the matrix A for future use
71 A = sparse(A); %use sparse solver
72 tstep = get tsteps(tplot,dt);
73 nplots = length(tplot);