Change Stacking Order of Plots
29 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mukul
am 29 Nov. 2024 um 17:24
Kommentiert: Mukul
am 30 Nov. 2024 um 2:46
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 30 Nov. 2024 um 2:21
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)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!