Main Content


Solve PDE specified in a PDEModel



result = solvepde(model) returns the solution to the stationary PDE represented in model. A stationary PDE has the property model.IsTimeDependent = false. That is, the time-derivative coefficients m and d in model.EquationCoefficients must be 0.


result = solvepde(model,tlist) returns the solution to the time-dependent PDE represented in model at the times tlist. At least one time-derivative coefficient m or d in model.EquationCoefficients must be nonzero.


collapse all

Create a PDE model, and include the geometry of the L-shaped membrane.

model = createpde();

View the geometry with edge labels.

axis equal

Figure contains an axes object. The axes object contains 11 objects of type line, text.

Set zero Dirichlet conditions on all edges.

applyBoundaryCondition(model,"dirichlet", ...
                             "Edge",1:model.Geometry.NumEdges, ...

Poisson's equation is


Toolbox solvers address equations of the form


Include the coefficients for Poisson's equation in the model.


Mesh the model and solve the PDE.

results = solvepde(model);

View the solution.


Figure contains an axes object. The axes object contains an object of type patch.

Create a model with 3-D rectangular block geometry.

model = createpde();

Suppose that radiative cooling causes the solution to decrease as the cube of temperature on the surface of the block.

gfun = @(region,state)-state.u.^3*1e-6;
applyBoundaryCondition(model,"neumann", ...
                             "Face",1:model.Geometry.NumFaces, ...

The model coefficients have no source term.


The block starts at a constant temperature of 350.


Mesh the geometry and solve the model for times 0 through 20.

tlist = 0:20;
results = solvepde(model,tlist);

Plot the solution on the surface of the block at times 1 and 20.



Input Arguments

collapse all

PDE model, specified as a PDEModel object. The model contains the geometry, mesh, and problem coefficients.

Example: model = createpde(1)

Solution times, specified as a real vector. tlist must be a monotone vector (increasing or decreasing).

Example: 0:20

Data Types: double

Output Arguments

collapse all

PDE results, returned as a StationaryResults object or as a TimeDependentResults object. The type of result depends on whether model represents a stationary problem (model.IsTimeDependent = false) or a time-dependent problem (model.IsTimeDependent = true).


  • If the Newton iteration does not converge, solvepde displays the error message Too many iterations or Stepsize too small.

  • If the initial guess produces matrices containing NaN or Inf elements, solvepde displays the error message Unsuitable initial guess U0 (default: U0 = 0).

  • If you have very small coefficients, or very small geometric dimensions, solvepde can fail to converge, or can converge to an incorrect solution. In this case, you might obtain better results by scaling the coefficients or geometry dimensions to be of order one.

Version History

Introduced in R2016a