x=[0:0.0001:1/10]; l=1000; clf e=0.1; plot(x,exp(-l*x)*e,'r'); % exact solution hold on u=[]; u(1)=e; h=0.00001; n=round(0.1/h); for i=1:n u(i+1)=1/(1+l*h)*u(i); end plot([1:n+1]*h,u);