Main Content

pdegplot

Plot PDE geometry

Description

example

pdegplot(g) plots the geometry of a PDE problem, as described in g.

example

pdegplot(g,Name,Value) plots with additional options specified by one or more name-value arguments. For example, you can specify whether to display vertex, edge, face, and cell labels.

h = pdegplot(___) returns handles to the graphics, using any of the previous syntaxes.

Examples

collapse all

Plot the geometry of a region defined by a few simple shapes.

g = [2	 1      1     1      1     1      1     1     1     4     4;
    -1	-0.6   -0.5  -0.4   -0.5   0.4	  0.5	0.6   0.5  -1	  0.17;
     1	-0.5   -0.4  -0.5   -0.6   0.5    0.6   0.5   0.4   0.17  1;
     0	-0.25  -0.35 -0.25  -0.15 -0.25  -0.35 -0.25 -0.15  0    -0.74;
     0	-0.35  -0.25 -0.15  -0.25 -0.35	 -0.25 -0.15 -0.25 -0.74  0;
     0	 0      0     0      0     0      0     0     0     1     1;
     1	 1      1     1      1     1      1     1     1     0     0;
     0  -0.5   -0.5  -0.5   -0.5   0.5    0.5   0.5   0.5   0     0;
     0  -0.25  -0.25 -0.25  -0.25 -0.25  -0.25 -0.25 -0.25  0     0;
     0	 0.1    0.1   0.1    0.1   0.1    0.1   0.1   0.1   1     1;
     0	 0      0     0      0     0      0     0     0     0.75  0.75;
     0	 0      0     0      0     0      0     0     0     0     0];
 pdegplot(g)

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

View the vertex labels, edge labels, and the face label. Add space at the top of the plot to see the top edge clearly.

pdegplot(g,"VertexLabels","on","EdgeLabels","on","FaceLabels","on")
ylim([-.8,.1])

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

Import a 3-D geometry file. Plot the geometry and turn on face labels. To see the labels on all faces of the geometry, set the transparency to 0.5.

model = createpde;
importGeometry(model,"BracketWithHole.stl");
pdegplot(model,"FaceLabels","on","FaceAlpha",0.5)

Figure contains an axes object. The axes object contains 6 objects of type quiver, text, patch, line.

Import a 3-D geometry file. Plot the geometry and turn on cell labels.

model = createpde;
importGeometry(model,"DampingMounts.stl");
pdegplot(model,"CellLabels","on")

Figure contains an axes object. The axes object contains 6 objects of type quiver, text, patch, line.

Since R2023b

Create and plot a 3-D geometry consisting of three nested cuboids of the same height. By default, pdegplot uses lighting effects to display geometric features, like different cells, with more contrast.

gm = multicuboid([2 3 5],[4 6 10],3);
pdegplot(gm,CellLabels="on",FaceAlpha=0.3)

Figure contains an axes object. The axes object contains 6 objects of type quiver, text, patch, line.

To obtain the same plot appearance as in R2023a or earlier, turn off the lighting effects.

figure
pdegplot(gm,CellLabels="on",FaceAlpha=0.3,Lighting="off")

Figure contains an axes object. The axes object contains 6 objects of type quiver, text, patch, line.

Input Arguments

collapse all

Geometry description, specified by one of these values:

Data Types: double | char | string | function_handle

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: pdegplot(g,FaceLabels="on")

Vertex labels for 2-D or 3-D geometry, specified as "off" or "on".

Data Types: char | string

Boundary edge labels for 2-D or 3-D geometry, specified as "off" or "on".

Data Types: char | string

Boundary face labels for 2-D or 3-D geometry, specified as "off" or "on".

Data Types: char | string

Cell labels for 3-D geometry, specified as "off" or "on".

Data Types: char | string

Surface transparency for 3-D geometry, specified as a real number from 0 through 1. The default value 1 indicates no transparency. The value 0 indicates complete transparency.

Example: FaceAlpha=0.5

Data Types: double

Since R2023b

Lighting effects for 3-D geometry, specified as "on" or "off".

Data Types: char | string

Output Arguments

collapse all

Handles to graphics objects, returned as a vector.

Alternative Functionality

App

If you create a 2-D geometry in the PDE Modeler app, you can view the geometry from Boundary Mode. To see the edge labels, select Boundary > Show Edge Labels. To see the face labels, select PDE > Show Subdomain Labels.

Version History

Introduced before R2006a

expand all