How do I mesh a matlab model

6 次查看(过去 30 天)
I am trying to mesh a geometry. The geometry was modelled on matlab. Most meshing examples on matlab involve importing of the geometry. How do I mesh a model that was made in matlab. The model code as well as the mesh code has been given below.
rect1=[3
4
-530
530
530
-530
0
0
-530
-530];
C1=[1
0
0
228.6];
C2=[1
0
0
520.5];
C1 = [C1;zeros(length(rect1) - length(C1),1)];
C2 = [C2;zeros(length(rect1) - length(C2),1)];
gd = [C1,C2,rect1];
ns = (char('C1','C2','rect1'));
ns = ns';
sf='(C2)-(C1+rect1)';
dl = decsg(gd,sf,ns);
model = createpde("thermal","transient");
ge = geometryFromEdges(model,dl);
% 2D -> 3D extrusion
gd1 = extrude(ge,96);
figure
pdegplot(gd1,"FaceLabels","on")
model = femodel(Geometry="gd1");
model = generateMesh(model,Hmax=5,Hmin=1);
pdemesh(model)

采纳的回答

sai charan sampara
sai charan sampara 2024-6-11
Hello
There need not be inverted commas over the geometry type in the line where "femodel" is defined. I have increased the "Hmax" value to decrease the run time of the code. The following code might help you:
rect1=[3
4
-530
530
530
-530
0
0
-530
-530];
C1=[1
0
0
228.6];
C2=[1
0
0
520.5];
C1 = [C1;zeros(length(rect1) - length(C1),1)];
C2 = [C2;zeros(length(rect1) - length(C2),1)];
gd = [C1,C2,rect1];
ns = (char('C1','C2','rect1'));
ns = ns';
sf='(C2)-(C1+rect1)';
dl = decsg(gd,sf,ns);
model = createpde("thermal","transient");
ge = geometryFromEdges(model,dl);
% 2D -> 3D extrusion
gd1 = extrude(ge,96);
figure
pdegplot(gd1,"FaceLabels","on")
model = femodel(Geometry=gd1);
model = generateMesh(model,Hmax=50,Hmin=1);
pdemesh(model)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Unified Modeling 的更多信息

标签

产品


版本

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by