필터 지우기
필터 지우기

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 CenterFile Exchange에서 Geometry and Mesh에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by