Change Stacking Order of Plots
조회 수: 3 (최근 30일)
이전 댓글 표시
Setting up a manual FEM solver, I found the temperatures at nodes for mesh generated with the PDE Toolbox. I used these temperature values to get the surface plot as shown below.
results = createPDEResults(model,T); % T contains the nodal temperature values
%%
f1 = figure;
pdeplot(results.Mesh, XYData=results.NodalSolution, ZData=results.NodalSolution, ColorMap="jet");
view(2)
axis equal
hold on
pdegplot(model);
hold off
hold on
x = linspace(0,L,20); y = linspace(0,h,10);
[X, Y] = meshgrid(x,y);
[dTdx, dTdy] = evaluateGradient(results, X, Y);
dTdx = reshape(dTdx, size(X));
dTdy = reshape(dTdy, size(Y));
quiver(X, Y, (-k).*dTdx, (-k).*dTdy, "k", "LineWidth", 1);
hold off
h = colorbar;
set(get(h,'title'),'string',('T [°C]'));
clim([min(T), max(T)]);
I have two questions regarding this:
- How can I change the order of the plots so that the quiver plot is seen above the surface plot?
- Is it possible to find the temperature values for points in between the nodes on the plot directly?

댓글 수: 0
채택된 답변
Walter Roberson
2024년 11월 30일
pdeplot(results.Mesh, XYData=results.NodalSolution, ZData=results.NodalSolution, ColorMap="jet");
view(2)
Those lines imply that pdeplot is creating a 3D plot with ZData given by NodalSolution
quiver(X, Y, (-k).*dTdx, (-k).*dTdy, "k", "LineWidth", 1);
quiver() creates a 2D plot -- a plot with ZData all zero.
So your basic problem appears to be that the Z component of the surface is greater than the all-zero Z components of the quiver plot. When you look down from the top as in view(2), Z values that are greater are "closer" to the viewpoint and take priority in drawing.
You might need to quiver3() and specify the Z values as results.NodalSolution to raise the quiver lines to the same level as the surface plotted by pdeplot()
Or you could create a hgtransform and parent the pdeplot and quiver to the transform group, and set the Matrix to invert the Z axis, so that the zeros from the quiver become closer than the results.NodalSolution
Or you could use
ZData=-results.NodalSolution, ColorMap=flipud(jet)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!