% % w05diff.m - diffusion solutions (djm: 04 oct 2010) % Lx = 5; dx = Lx/200; xp = dx:dx:Lx; xx = [-Lx:dx:Lx]; figure(1); clf subplot(2,1,1) for tt = [(1:6).^2] plot(xx,(1+erf(xx/sqrt(tt)))/2,'r'); hold on end plot( xp, ones(size(xp)),'k','linewidth',2) plot(-xp,zeros(size(xp)),'k','linewidth',2) plot([0 0],[0 1],'ko') plot([0],[1/2],'k.') axis([-Lx Lx -0.1 1.1]) title('\bf similarity-based diffusion solutions') ylabel('\bf Q(x,t)') xlabel('\bf x-axis') text(-0.2,0.8 ,'t = 1') text( 3.0,0.65,'t = 36') subplot(2,1,2) for tt = [(1:6).^(-2)] plot(xx,exp(-(xx/(4*tt)).^2)/sqrt(4*tt)/sqrt(pi),'r'); hold on end axis([-Lx Lx -0.1 2]) ylabel('\bf G(x,t)') xlabel('\bf x-axis') text( 3.2,0.3 ,'t = 1') text(-1.1,1.6,'t = 1/36')