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