===== Matlabfiler (Matlab files) ===== [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/ssheat.m|ssheat.m]] Steady state heat equation in 1 D. Global error computed from a truncated Taylor expansion of the local truncation error, for different values of the discretization step h. The grid-function-norm of the global error is plotted against h in a loglog plot and compared to a reference line producing numerical evidence that the norm of the global error tends to zero has O(h^2). [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/ssheatNeumann.m|ssheatNeumann.m]] Steady state heat equation in 1 D, Neumann boundary conditions on one 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 for imposing the Neumann buondary conditions. [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/pendulum.m|pendulum.m]] Discretization of the pendulum boundary value problem. Dirichlet boundary conditions. Solution of the nonlinear system of equations by Newton iteration. [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/G.m|G.m]] Matlab function defining the nonlinear broblem whose solution is the numerical approximation of the pendulum BVP. [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/JacG.m|JacG.m]] Jacobian of G. [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/convdiff.m|convdiff.m]] Boundary layer problem. Advection diffusion equation with small viscosity. Discretization of the first derivative with central differences and backward differences. **Heat equation** [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/EEheat.m|EEheat.m]] Forward Euler method for the heat equation. [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/CNheat.m|CNheat.m]] Crank-Nicolson method for the heat equation. [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/HePer.m|HePer.m]] Semidiscretization of the heat equation. Periodic boundary conditions. Uses the function [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/funcHePer.m|funcHePer.m]] as input to the integrator ode15s of Matlab. [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/HeNeu.m|HeNeu.m]] Semidiscretization of the heat equation. Neuman boundary conditions. Uses the functions [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/funcHeNeu.m|funcHePer.m]] and [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/gHeNeu.m|gHeNeu.m]] for the boundary conditions. **Nonlinear parabolic equations** [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/NW.m|NW.m]] Newell Withehead equation with Dirichlet boundary conditions and two different initial conditions (one of them corresponds to a known exact solution). Semidiscretization: the function [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/funcNW.m|funcNW.m]] defines the right hand side of the system of ODEs, [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/gNW.m|gNW.m]] and [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/gNWex.m|gNWex.m]] define the boundary conditions for the two different initial values. [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/NHeat.m|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 [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/funcNhe.m|funcNhe.m]] defines the right hand side of the system of ODEs, [[http://www.math.ntnu.no/~elenac/numdiffdm/2009v/matlab/gNhe.m|gNhe.m]] defines the boundary conditions (in the same file are implemented two sets of boundary conditions corresponding to the two solutions).