
24.2. Numerical Solutions of Linear PDEs 1377
0 0.2 0.4 0.6 0.8 1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Solution profile at t
k
=0, 1/2, 1
x
u(x,t
k
)
t=0
t=1/2
t=1
Figure 24.1 Surface profiles of the solution of the linear heat equation at t
k
= 0,
1
2
,1.
figure(2);
plot(x,u(1,:),'k-',x,u(3,:),'k--',x,u(5,:),'k:','LineWidth',2);
set(gca,'FontSize',14); set(gca,'FontName','Arial'); set(gca,'LineWidth',1);
title('Solution profile at t_k=0, 1/2, 1');
xlabel('x'); ylabel('u(x,t_k)'); legend('t=0','t=1/2','t=1');
figure(3);
G=plot(x,u(1,:),'erase','xor');
for k=2:length(t) set(G,'xdata',x,'ydata',u(k,:)); pause(0.7); end
title('Animation of the solution'); xlabel('x'); ylabel('u(x,t_k)'); ...