Scale 2-D Geometry
Scale a 2-D geometry along the x- and y-axis and ensure consistency with the mesh.
Create a model.
model = createpde;
Import and plot a geometry.
g = importGeometry(model,"PlateHolePlanar.stl"); pdegplot(model)
Mesh the geometry and plot the mesh.
generateMesh(model); figure pdemesh(model)
Scale the geometry by a factor of 10 along the x-axis.
ans = DiscreteGeometry with properties: NumCells: 0 NumFaces: 1 NumEdges: 5 NumVertices: 5 Vertices: [5x3 double]
Plot the geometry.
Plot the geometry and mesh. The
scale function modifies a geometry, but it does not modify a mesh.
figure pdegplot(model) hold on pdemesh(model)
After modifying the geometry, always regenerate the mesh.
generateMesh(model); figure pdegplot(model) hold on pdemesh(model)
Reflect the geometry across the x-axis and regenerate the mesh.
scale(g,[1 -1]); generateMesh(model);
Plot the resulting geometry and mesh.
figure subplot(2,1,1) pdegplot(model) subplot(2,1,2) pdemesh(model)
Scale 3-D Geometry
Enlarge a geometry: first uniformly in all directions, and then using different scaling factors along different axes.
Create and plot a geometry.
g = multicuboid(1,1,1); pdegplot(g,"VertexLabels","on","FaceAlpha",0.5)
Scale the geometry by a factor of 2 uniformly along all coordinate axes. Plot the result.
Now scale by factors of 2, 3, and 4 along the x-, y-, and z-axes, respectively. Plot the result.
scale(g,[2 3 4]); pdegplot(g,"VertexLabels","on","FaceAlpha",0.5)
Flip the geometry upside down by scaling it with the factor
-1 and using the bottom front corner (vertex 1) as a reference point.
scale(g,[1 1 -1], [2 -3 0]); pdegplot(g,"VertexLabels","on","FaceAlpha",0.5)
g — Geometry
fegeometry object |
DiscreteGeometry object |
Geometry, specified as an
fegeometry object, a
DiscreteGeometry object, or an
DiscreteGeometry Properties, and AnalyticGeometry Properties.
s — Scaling factor
nonzero real number | vector of two or three nonzero real numbers
Scaling factor, specified as a real number or vector of two or three real numbers. Use one value for uniform scaling in all directions. Use a vector of two or three elements to specify different scaling factors along the x-, y-, and, for a 3-D geometry, z-axes.
refpoint — Reference point for scaling
vector of two or three real numbers
Reference point for scaling specified as a vector of two or three real numbers for a 2-D and 3-D geometry, respectively
h — Resulting geometry
fegeometry object | handle
Resulting geometry, returned as an
fegeometry object or a
If the original geometry
his a new
fegeometryobject representing the modified geometry. The original geometry
If the original geometry
his a handle to the modified
his a handle to a new
DiscreteGeometryobject. The original geometry
After modifying a geometry, regenerate the mesh to ensure a proper mesh association with the new geometry.
If the scaling factor is negative, then the coordinates will flip their signs. The scaling factor of
-1mirrors the existing geometry if the reference point is the origin.
AnalyticGeometryobject, and you want to replace it with the modified geometry, assign the output to the original geometry, for example,
g = scale(g,20).
Version HistoryIntroduced in R2020a
R2023a: Finite element model
scale now accepts geometries specified by
R2021a: Geometry transformation for analytic geometries
scale now works with