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 31 class discussing power spectra of various functions class_mar31a.m It uses the script find_spec.m .

Here's a script comparing finite difference approximations of derivatives to spectral approximations of derivatives. class_mar31b.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 31 class comparing different spectral approaches to solving the heat equation. class_mar31c.m It uses the scripts heat4.m, heat5.m, heat6.m, and heat7.m.
This solves the heat equation by treating the linear term explicitly heat4.m
This solves the heat equation by treating the linear term implicitly heat5.m
This solves the heat equation by Crank-Nicolson heat6.m
This solves the heat equation exactly heat7.m

Here's a script from the April 7 class comparing different spectral approaches to Burger's equation compare_burgers.m . It uses the scripts burgers_ab.m, burgers_ee.m, burgers_ie, and burgers_if.m.
This solves Burger's equation by treating both the linear term and the nonlinear term explicitly burgers_ee.m . Here's a tester script.
This solves Burger's equation by treating the linear term implicitly and the nonlinear term explicitly burgers_ie.m Here's a tester script.
This solves Burger's equation using second-order Adams-Bashforth burgers_ab.m Here's a tester script.
This solves Burger's equation using a first-order integrating factor method burgers_if.m Here's a tester script.

Here's the script where we looked at the effect of diffusion for initial data which results in a finite-time shock when there's no diffusion class_Apr7.m

Here's a script from the April 9 class comparing different spectral approaches to the Nonlinear Schroedinger equation class_Apr9.m . It uses the scripts split_schroedinger1.m, split_schroedinger2.m, and split_schroedinger3.m.
This solves the NLS using an O(k) splitting method: split_schroedinger1.m .
This solves the NLS using the O(k^2) Strang splitting method: split_schroedinger2.m .
This solves the NLS using an O(k^4) method which is Strang splitting accelerated via Richardson extrapolation: split_schroedinger3.m .