フィルターのクリア

Combining a pdeplot3D mesh plot with a quiver3 vector plot

1 回表示 (過去 30 日間)
Vincent B
Vincent B 2021 年 5 月 10 日
回答済み: Gautam 2024 年 2 月 26 日
I want to plot a mesh via pdeplot3D, and in the same plot draw arrows that indicate force vectors. I already tried the following two approaches that don't give me the result I'm looking for.
With hold on/hold off:
hold on
pdeplot3D(smodel);
quiver3(msh.Nodes(1,:), msh.Nodes(2,:), msh.Nodes(3,:), forces_xyz(:,1).', forces_xyz(:,2).', forces_xyz(:,3).');
hold off
...gives me two plots.
With the pdeplot3D-builtin FlowData functionality:
pdeplot3D(smodel, 'FlowData', forces_xyz, 'Mesh', 'on');
... only plots the arrows, not the mesh.
Does anyone know a way how to superimpose arrows on a mesh plot from pdeplot3D?

回答 (1 件)

Gautam
Gautam 2024 年 2 月 26 日
Hello Vincent,
I understand that you want to plot a mesh using the function “pdeplot3D” and indicate the force vectors using the function “quiverplot” on the same plot. You can do this by adding the “hold on” command between the two function call for the respective plots as shown below
pdeplot3D(smodel, "FaceAlpha", 0.1);
hold on;
quiver3(mesh.Nodes(1,:), mesh.Nodes(2,:), mesh.Nodes(3,:), qx',qy',qz',10);
hold off
This plots the mesh and the force vectors on the same axes as shown in the figure below.
You can refer the MathWorks documentation for more information on the “hold” command from the link below
  1. hold: https://www.mathworks.com/help/releases/R2021a/matlab/ref/hold.html?&s_tid=doc_srchtitle#:~:text=Create%20a%20line,y2)%0Ahold%20off

カテゴリ

Help Center および File ExchangeGeometry and Mesh についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by