Mathematics 
MATLAB Partial Differential Equation Solver
pdepe
The PDE Solver
The MATLAB PDE solver, pdepe
, solves initialboundary value problems for systems of parabolic and elliptic PDEs in the one space variable and time . There must be at least one parabolic equation in the system.
The pdepe
solver converts the PDEs to ODEs using a secondorder accurate spatial discretization based on a fixed set of nodes specified by the user. The discretization method is described in [9]. The time integration is done with ode15s
. The pdepe
solver exploits the capabilities of ode15s
for solving the differentialalgebraic equations that arise when Equation 53 contains elliptic equations, and for handling Jacobians with a specified sparsity pattern. ode15s
changes both the time step and the formula dynamically.
After discretization, elliptic equations give rise to algebraic equations. If the elements of the initial conditions vector that correspond to elliptic equations are not "consistent" with the discretization, pdepe
tries to adjust them before beginning the time integration. For this reason, the solution returned for the initial time may have a discretization error comparable to that at any other time. If the mesh is sufficiently fine, pdepe
can find consistent initial conditions close to the given ones. If pdepe
displays a message that it has difficulty finding consistent initial conditions, try refining the mesh. No adjustment is necessary for elements of the initial conditions vector that correspond to parabolic equations.
PDE Solver Basic Syntax
The basic syntax of the solver is
Note Correspondences given are to terms used in Introduction to PDE Problems. 
m 
Specifies the symmetry of the problem. 
pdefun 
Function that defines the components of the PDE. It computes the terms , , and in Equation 53, and has the form where x and t are scalars, and u and dudx are vectors that approximate the solution and its partial derivative with respect to . c , f , and s are column vectors. c stores the diagonal elements of the matrix . 
icfun 
Function that evaluates the initial conditions. It has the form When called with an argument x , icfun evaluates and returns the initial values of the solution components at x in the column vector u . 
bcfun 
Function that evaluates the terms and of the boundary conditions. It has the form where 
xmesh 
Vector [x0 , x1 , ..., xn ] specifying the points at which a numerical solution is requested for every value in tspan . x0 and xn correspond to and , respectively. Secondorder approximation to the solution is made on the mesh specified in xmesh must satisfy x0 < x1 < ... < xn . The length of xmesh must be 3 . 
tspan 
Vector [
The elements of 
The output argument sol
is a threedimensional array, such that:
sol
(:
,:
,k
) approximates component k
of the solution .
sol
(i
,:
,k
) approximates component k
of the solution at time tspan
(i
) and mesh points xmesh(:)
.
sol
(i,j,k
) approximates component k
of the solution at time tspan
(i
) and the mesh point xmesh(j)
.
Additional PDE Solver Arguments
For more advanced applications, you can also specify as input arguments solver options and additional parameters that are passed to the PDE functions.

Structure of optional parameters that change the default integration properties. This is the seventh input argument. See Changing PDE Integration Properties for more information. 
Introduction to PDE Problems  Solving PDE Problems 
© 19942005 The MathWorks, Inc.