Linear Convection
Objective: clear all close all clc %inputs for the linear convection problem L=1; n=80; c=1; dt=0.0001; %calculations x=linspace(0,L,n); dx=x(2)-x(1); %define the start and end points of a square wave n_start=9; n_stop=25; %Initialize arrays & apply boundary conditions u=ones(1,n); u(n_start:n_stop)=2; %BC u(1)=1; uold=u; u_initial=u;…