Week 4 - Linear Convection
Objective: clear allclose allclcL=1;C=1;n=[20 40 80 160];t=0.4;dt=0.01;nt=(t/dt)+1;for k=1:length(n) number_of_nodes=n(k); x=linspace(0,L,n(k)); dx=x(2)-x(1); % BC u=ones(1,n(k)); % defining initial velocity profile x_start=0.1; x_stop=0.3; B=find(x>0.1 & x<0.3); n_start=B(1,1); n_stop=B(end); u(n_start:n_stop)=2; for i=1:nt…