Display pdeplot3D in Matlab App

9 ビュー (過去 30 日間)
Marco Mader Mendes
Marco Mader Mendes 2022 年 3 月 31 日
コメント済み: xiaoli 2024 年 1 月 24 日
Hello I want to display a pdeplot3D or a pdeplot in a Matlab App (using Matlab Appdesigner).
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?

採用された回答

Kevin Holly
Kevin Holly 2022 年 4 月 1 日
編集済み: Kevin Holly 2022 年 4 月 1 日
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 件のコメント
Marco Mader Mendes
Marco Mader Mendes 2022 年 4 月 4 日
Thank you a lot for your help!
The Solution is just what I was looking for!
Thanks!
xiaoli
xiaoli 2024 年 1 月 24 日
Thanks!
I also meet the same problem

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by