Main Content


(To be removed) Contour plot of PDE node or triangle data

pdecont will be removed in a future release. Use pdeplot instead. For more information, see Compatibility Considerations.



pdecont(p,t,u) creates a contour plot of node data or triangle data. By default, pdecont uses 10 levels for a contour plot. The p and t arguments specify the geometry of the PDE problem.

If u is a column vector, pdecont treats it as a node data. If u is a row vector, pdesurf treats it as a triangle data.


pdecont(p,t,u,n) plots n levels.


pdecont(p,t,u,v) plots levels at the solution heights specified by v.

h = pdecont(___) uses any of the previous syntaxes and returns handles to the drawn axes objects.


collapse all

Plot contours of the solution to the equation - Δ u = 1 on the L-shaped membrane using the pdecont function.

First, create and refine a [p,e,t] mesh on the L-shaped membrane.

[p,e,t] = initmesh('lshapeg');
[p,e,t] = refinemesh('lshapeg',p,e,t);

Solve the equation using the Dirichlet boundary conditions u = 0 on Ω .

u = assempde('lshapeb',p,e,t,1,0,1);

Plot the solution using the pdesurf function.


Surface plot of the solution

Plot contours of the solution using the pdecont function. By default, there are 10 levels.


Contour plot with ten levels

Now plot the contours using three levels.


Contour plot with the first three levels

Plot the contours of the solution at the heights 0, 0.05, 0.1, and 0.14.

pdecont(p,t,u,[0 0.05 0.1 0.14])

Contour plot of the solution at the specified levels

Input Arguments

collapse all

Mesh points, specified as a 2-by-Np matrix of points, where Np is the number of points in the mesh. For details on the mesh data representation, see initmesh.

Data Types: double

Mesh triangles, specified as a 4-by-Nt matrix of triangles, where Nt is the number of triangles in the mesh. For details on the mesh data representation, see initmesh.

Data Types: double

PDE solution, specified as a vector.

The pdesurf function treats a column vector as node data and uses continuous style and interpolated shading. The function treats a row vector as triangle data and uses discontinuous style and flat shading.

Data Types: double

Number of levels, specified as a positive integer.

Data Types: double

Levels to plot, specified as a vector of heights.

Data Types: double

Output Arguments

collapse all

Handles to graphics objects, returned as a vector.


  • For more control over a contour plot, use the pdeplot function.

Version History

Introduced before R2006a

expand all

Not recommended starting in R2022a

See Also