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
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.
uses any of the
previous syntaxes and returns handles to the drawn axes objects.
h = pdecont(___)
Contour Plot of PDE Solution
Plot contours of the solution to the equation on the L-shaped membrane using the
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 on .
u = assempde('lshapeb',p,e,t,1,0,1);
Plot the solution using the
Plot contours of the solution using the
pdecont function. By default, there are 10 levels.
Now plot the contours using 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])
p — Mesh points
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
t — Mesh triangles
Mesh triangles, specified as a
of triangles, where
Nt is the number of triangles in the mesh. For
details on the mesh data representation, see
u — PDE solution
PDE solution, specified as a vector.
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.
n — Number of levels
Number of levels, specified as a positive integer.
v — Levels to plot
vector of heights
Levels to plot, specified as a vector of heights.
h — Handles to graphics objects
Handles to graphics objects, returned as a vector.
For more control over a contour plot, use the