Display pdeplot3D in Matlab App
9 views (last 30 days)
Show older comments
Marco Mader Mendes
on 31 Mar 2022
Commented: xiaoli
on 24 Jan 2024
The Plot should be embedded in the main view and not be opend in a new Window.
To sum it up: I want to use the plot created by following command:
pdeplot3D(model,'ColorMapData',result.Stress.sxx,'Deformation',result.Displacement)
directly in Matlab Appdesigner.
The User should be able to make changes (e.q. change Boundary Conditions) and should see the newly generated plot in the App.
How can I achieve this?
0 Comments
Accepted Answer
Kevin Holly
on 1 Apr 2022
Edited: Kevin Holly
on 1 Apr 2022
In App Designer you need to defined the Axes. It looks like pdeplot3D does not have an input for Axes - it generates one with the newplot command. Below is a work around.
model = createpde;
importGeometry(model,'Block.stl');
applyBoundaryCondition(model,'dirichlet','Face',[1:4],'u',0);
specifyCoefficients(model,'m',0,'d',0,'c',1,'a',0,'f',2);
generateMesh(model);
results = solvepde(model);
u = results.NodalSolution;
h = pdeplot3D(model,'ColorMapData',u);
h(2).Parent = app.UIAxes;
view(app.UIAxes,45,45)
colorbar(app.UIAxes)
close(h(1).Parent)
axis(app.UIAxes,'off')
Edit: This one would be more simliar to yours since you had a transform (notice you need to change the parent of the parent of the handle rather than just the parent of the handle due to the transform).
structuralmodel = createpde('structural','static-solid');
importGeometry(structuralmodel,'SquareBeam.stl');
structuralProperties(structuralmodel,'PoissonsRatio',0.3, ...
'YoungsModulus',210E3);
structuralBC(structuralmodel,'Face',6,'Constraint','fixed');
structuralBoundaryLoad(structuralmodel,'Face',5, ...
'SurfaceTraction', ...
[0;0;-2]);
generateMesh(structuralmodel);
structuralresults = solve(structuralmodel);
figure
h = pdeplot3D(structuralmodel, ...
'ColorMapData',structuralresults.VonMisesStress, ...
'Deformation',structuralresults.Displacement)
h(2).Parent.Parent = app.UIAxes;
view(app.UIAxes2,45,45)
colorbar(app.UIAxes)
close(h(1).Parent)
axis(app.UIAxes,'off')
2 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!