Combining a pdeplot3D mesh plot with a quiver3 vector plot

3 visualizaciones (últimos 30 días)
Vincent B
Vincent B el 10 de Mayo de 2021
Respondida: Gautam el 26 de Feb. de 2024
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?

Respuestas (1)

Gautam
Gautam el 26 de Feb. de 2024
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

Community Treasure Hunt

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

Start Hunting!

Translated by