MATLAB files

ssheat.m Steady state heat equation in 1D. Error computed using the knowledge of the exact solution of the problem. We plot the 2-norm of the error (interpreted as a piecewise constant function) as a function of discretization step h. We use a loglog plot and compare the result to a reference line g(h)=h², producing numerical evidence that the norm of the global error tends to zero as O(h²).

ssheatNeumann.m Steady state heat equation in 1D, Neumann boundary conditions on the left end side and Dirichlet on the other side. Error computed using the exact solution. By modifying the matrix A and the right hand side F one can easily implement the three different approaches described in chapter 2 of RLV book for imposing the Neumann boundary conditions.

pendulum.m Discretization of the pendulum boundary value problem. Dirichlet boundary conditions. Solution of the nonlinear system of equations by Newton iteration.
G.m MATLAB function defining the nonlinear problem whose solution is the numerical approximation of the pendulum BVP.
JacG.m Jacobian of G.

convdiff.m Boundary layer problem. Advection-diffusion equation with small viscosity. Discretization of the first derivative with central differences and backward differences.

Heat equation

EEheat.m Forward Euler method for the heat equation.

CNheat.m Crank–Nicolson method for the heat equation. Uses Au.m to solve the semi-discretized heat equation with ode15s and compare it with the Crank-Nicolson method for different time step-sizes.

http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/HePer.m Coming up. Semidiscretization of the heat equation. Periodic boundary conditions. Uses the function funcHePer.m as input to the integrator ode15s of MATLAB.

http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/HeNeu.m Coming up. Semidiscretization of the heat equation. Neuman boundary conditions. Uses the functions funcHeNeu.m and gHeNeu.m for the boundary conditions.

Nonlinear parabolic equations

NW.m Newell–Whitehead equation with Dirichlet boundary conditions and two different initial conditions (one of them corresponds to a known exact solution). Semidiscretization: the function funcNW.m defines the right hand side of the system of ODEs, gNW.m and gNWex.m define the boundary conditions for the two different initial values.

NHeat.m Nonlinear heat equation with an exponential nonlinearity, with Dirichlet boundary conditions and two different initial conditions (one of them corresponds to a known exact solution). Semidiscretization: the function funcNhe.m defines the right hand side of the system of ODEs, gNhe.m defines the boundary conditions (in the same file two sets of boundary conditions corresponding to the two solutions are implemented).




2011-01-28, Elena Celledoni