Clear Filters
Clear Filters

How do I mesh a matlab model

3 views (last 30 days)
N G
N G on 11 Jun 2024
Answered: sai charan sampara on 11 Jun 2024
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)

Accepted Answer

sai charan sampara
sai charan sampara on 11 Jun 2024
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)

More Answers (0)

Categories

Find more on Dynamic System Models in Help Center and File Exchange

Tags

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!