error code using pdeplot function.

4 次查看(过去 30 天)
Shikun Nie
Shikun Nie 2022-2-18
回答: SAI SRUJAN 2023-12-28
My code is as below. Some of the functions are defined in separate files not shown here.
tiledlayout(3,2);
load("video.mat");
msh1.P=P;
msh1.E=E;
msh1.T=T;
Mbar1 = discretiseLinearElasticity(msh1);
nexttile;
pdemesh(msh1.P,msh1.E,msh1.T);
axis equal;
nexttile;
spy(Mbar1);
load("kiwi.mat");
msh2.P=P;
msh2.E=E;
msh2.T=T;
Mbar2 = discretiseLinearElasticity(msh2);
nexttile;
pdemesh(msh2.P,msh2.E,msh2.T);
axis equal;
nexttile;
spy(Mbar2);
u = sin(msh2.P(1,:)).*cos(msh2.P(2,:));
norm = (u * Mbar2 * u')^0.5;
disp(norm);
nexttile;
pdeplot(msh2.P,msh2.E,msh2.T,'ZData', u);
The error is as follows. But the plot did appear to be correct after execution. Basically I don't know what causes this error.
Error using matlab.graphics.layout.TiledChartLayout/set
Unrecognized property currentaxes for class TiledChartLayout.
Error in pdeplot (line 1142)
set(get(ax,'parent'),'currentaxes',ax)
Error in hw5 (line 27)
pdeplot(msh2.P,msh2.E,msh2.T,'ZData', u);
  2 个评论
KSSV
KSSV 2022-2-18
What version of MATLAB you are using?
What does
which tiledlayout
/MATLAB/toolbox/matlab/graphics/tiledlayout.p
show up for you?
Note that this option is available from 2019b.
Shikun Nie
Shikun Nie 2022-2-18
I am using R2021b.
>> which tiledlayout
C:\Program Files\MATLAB\R2021b\toolbox\matlab\graphics\tiledlayout.p

请先登录,再进行评论。

回答(1 个)

SAI SRUJAN
SAI SRUJAN 2023-12-28
Hi Shikun,
I understand that you are facing an issue using 'pdeplot' function in 'tiledlayout'.
'pdeplot' is a function in MATLAB used to plot the results of a PDE (Partial Differential Equation) solution, such as the geometry, mesh, and contours of the solution. When we want to include a 'pdeplot' in a 'tiledlayout', we can do so by creating the tiled layout first and then specifying the axes handle where the 'pdeplot' should be drawn.
Follow the given code snippet to proceed further,
figure;
% Create a tiledlayout to manage the layout of multiple plots.
tiledlayout(2, 1);
% Create an axes object within the tiledlayout using the nexttile function.
ax1 = nexttile;
model = createpde;
geometryFromEdges(model,@lshapeg);
mesh = generateMesh(model);
% Call pdeplot and specify the axes handle to draw the plot in the correct tile.
pdeplot(mesh, 'Parent', ax1);
ax2 = nexttile;
plot([1:100]);
The 'pdeplot' function uses the 'Parent' property to specify where the plot should appear.
For a comprehensive understanding of the 'tiledlayout' and 'pdeplot' function in MATLAB, please refer to the following documentation.
I hope this helps.

类别

Help CenterFile Exchange 中查找有关 Geometry and Mesh 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by