matlab *.m files to solve PDEs using spectral methods.

If these programs strike you as slightly slow, they are. They would run more quickly if they were coded up in C or fortran. As matlab programs, would run more quickly if they were compiled using the matlab compiler and then run within matlab.

Here's a script from the March 26 class discussing power spectra of various functions class_Mar26_decay.m It uses the script find_spec.m .

Here's a script comparing finite difference approximations of derivatives to spectral approximations of derivatives. class_Mar26_diff.m It uses the script d_mid.m, f.m, and fdiff.m and

All of the following codes are on [0,2 pi] and assume periodic boundary conditions.

Here's a script from the March 26 class comparing different spectral approaches to solving the diffusion equation. class_Mar26_heat.m It uses the scripts heat4.m, heat5.m, heat6.m, and heat7.m.
This solves the diffusion equation by treating the linear term with Forward Euler heat4.m
This solves the diffusion equation by treating the linear term with Backward Euler heat5.m
This solves the diffusion equation by Crank-Nicolson heat6.m
This solves the diffusion equation exactly heat7.m

Here's a script from the March 28 class discussing various ways to compute Burgers equation with dissipation, using spectral methods class_Mar28_burgers.m . The time-stepping codes use convolve.m.
Here's the Forward Euler time-stepping code.
Here's the time-stepping code that uses an integrating factor method.
Here's the implicit/explicit time-stepping code that handles the linear term with Backward Euler and the nonlinear term with Forward Euler.
Here's the second-order Adams-Bashforth time-stepping code.
Note that if the diffusion is zero (D=0) then the first three methods all reduce to the same method.

Here's a script from the April 4 class discussing various ways to compute the cubic nonlinear Schroeding equation, using spectral methods class_Apr4_schroedinger.m .
Here's the Lie splitting time-stepping code.
Here's the Strang splitting time-stepping code.
Here's the Strang splitting time-stepping with Richardson Extrapolation acceleration code.