pdecont

Contour plot of PDE node or triangle data

This page describes the legacy workflow. Use it when you work with legacy code and do not plan to convert it to use the recommended approach. Otherwise, use pdeplot.

Description

example

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.

example

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

example

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.

Examples

collapse all

Plot contours of the solution to the equation $-\Delta 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 $\partial \Omega$.

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

Plot the solution using the pdesurf function.

pdesurf(p,t,u) Plot contours of the solution using the pdecont function. By default, there are 10 levels.

pdecont(p,t,u) Now plot the contours using three levels.

pdecont(p,t,u,3) 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]) 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.

Tips

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