matlab *.m files to solve the advection equation.

These programs are for the equation u_t + a u_x = 0 where a is a constant.

In-class demo script: February 7.

These codes solve the advection equation using explicit upwinding. This one has boundary conditions for step function initial data built in (1 at the left and 0 at the right) and needs initial data provided via the function f. This one has periodic boundary conditions and needs initial data provided via the function g.

These codes solve the advection equation using the Lax-Friedrichs scheme. This one has boundary conditions for step function initial data. This one has periodic boundary conditions. Both need the initial data provided via the f.m and g.m as above.

These codes solve the advection equation using the Lax-Wendroff scheme. This one has boundary conditions for step function initial data. This one has periodic boundary conditions. Both need the initial data provided via the f.m and g.m as above.

These codes solve the advection equation using the Beam-Warming scheme. This one has boundary conditions for step function initial data. This one has periodic boundary conditions. Both need the initial data provided via the f.m and g.m as above.

Here are two scripts that test for the convergence of these schemes: For periodic boundary conditions you'll need the function file g.m and choose periodic initial data from within it. For step function boundary conditions you'll need to make sure that the initial data f.m has a step function in it.

Other miscellaneous things:
Two unstable codes: centered-difference scheme and explicit downwind scheme.
Here are files that show how I made my plots make_plots.m and more_plots.m.