This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Create 2-D geometry


pg = geometryFromEdges(model,g)



geometryFromEdges(model,g) adds the 2-D geometry described in g to the model container.

pg = geometryFromEdges(model,g) additionally returns the geometry to the Workspace.


collapse all

Create a decomposed solid geometry model and include it in a PDE model.

Create a default scalar PDE model.

model = createpde;

Define a circle in a rectangle, place these in one matrix, and create a set formula that subtracts the circle from the rectangle.

R1 = [3,4,-1,1,1,-1,0.5,0.5,-0.75,-0.75]';
C1 = [1,0.5,-0.25,0.25]';
C1 = [C1;zeros(length(R1) - length(C1),1)];
gm = [R1,C1];
sf = 'R1-C1';

Create the geometry.

ns = char('R1','C1');
ns = ns';
g = decsg(gm,sf,ns);

Include the geometry in the model and plot it.

axis equal

Input Arguments

collapse all

Model object, specified as a PDEModel object, ThermalModel object, or StructuralModel object.

Example: model = createpde(1)

Example: thermalmodel = createpde('thermal','steadystate')

Example: structuralmodel = createpde('structural','static-solid')

Geometry description, specified as a decomposed geometry matrix, as the name of a geometry function, or as a handle to a geometry function. For details, see Three Ways to Create 2-D Geometry.

Example: geometryFromEdges(model,@circleg)

Data Types: double | char | function_handle

Output Arguments

collapse all

Geometry object, returned as an AnalyticGeometry Properties object. This object is stored in model.Geometry.

Introduced in R2015a