pdesurf

Surface 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

pdesurf(p,t,u) plots a 3-D surface using PDE node or triangle data as a height for a 2-D problem. The p and t arguments specify the geometry of the PDE problem.

If u is a column vector, pdesurf treats it as node data and uses continuous style and interpolated shading. If u is a row vector, pdesurf treats it as triangle data and uses discontinuous style and flat shading.

h = pdesurf(p,t,u) returns handles to the drawn axes objects.

Examples

collapse all

Plot the solution of the equation $-\Delta u=1$ on the L-shaped membrane using the pdesurf function.

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

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

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 at the mesh nodes. When plotting the solution at the nodes, the function uses continuous style and interpolated shading.

pdesurf(p,t,u) Interpolate the solution from the mesh nodes to the triangle midpoints.

ut = pdeintrp(p,t,u);

Plot the interpolated solution. When plotting the solution as a triangle data, the function uses discontinuous style and flat shading.

pdesurf(p,t,ut) 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

Output Arguments

collapse all

Handles to graphics objects, returned as a vector.

Tips

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