clear all Nx=81;Nt=501; X=linspace(-3,3,Nx); T=linspace(0,2,Nt)'; XX=zeros(Nt,Nx); a=0; a=1*sqrt(exp(1)/2)-0.5; for ix=1:length(X); xi=X(ix); if a==0; G=exp(-xi^2)*T+xi; else; G=exp(-xi^2)*(1-exp(-a*T))/a+xi; end; figure(10) plot(G,T,'k') drawnow hold on end; figure(10) plot(X,exp(-X.^2)) xi=1/sqrt(2); Gi=exp(-xi^2)*T+xi; xi=0; G0=exp(-xi^2)*T+xi; plot(Gi,T,'r',G0,T,'k') xlabel('$x$','Interpreter','Latex','Fontsize',20) ylabel('$t$','Interpreter','Latex','Fontsize',20) %figure(10);hold off xp=linspace(sqrt(2),4,401); xn=-xp; xi1p=1/2*(xp+sqrt(xp.^2-2)); xi1n=1/2*(xp-sqrt(xp.^2-2)); xi2p=1/2*(xn+sqrt(xn.^2-2)); xi2n=1/2*(xn-sqrt(xn.^2-2)); t1p=exp(xi1p.^2)./(2*xi1p); t1n=exp(xi1n.^2)./(2*xi1n); figure(10) plot(xp,t1p,'g','Linewidth',2) plot(xp,t1n,'g','Linewidth',2) axis([0 2 0 2]) title('Characteristics and theie Envelop for $u_t + u u_x=0$ with $u(x,0)=e^{-x^2}$','Interpreter','Latex','Fontsize',18) hold off