Linear Convection
Objective: #comment the plot is not very good but the result is right Program for variable time step clear allclose allclcl=1n=80c=1dt1=1e-4dt2=1e-3dt3=1e-2dt4=1e-1t=0.4% calculationx=linspace(0,l,n)dx=x(2)-x(1)% initialization & B.C x-0.1 t0 0.3u=ones(1,n)n_start= 9 %0.1 x distance startn_stop= 25 %0.3 x distance endu(n_start:n_stop)=2uold=uui=u%time…