quiver3 with cylinders instead of arrows in matlab

Viewed 111

I have a vector field that is defined in a 2D plane. This means that the Z component of the position is constant, but vectors are 3D. I have plotted this using quiver3 as below:

[X,Y] = meshgrid(-pi/2:pi/8:pi/2,-pi/2:pi/8:pi/2);
Z=ones(size(X));
U=rand(size(X));
V=rand(size(X));
W=rand(size(X));
H=quiver3(X,Y,Z,U,V,W,'r');
H.ShowArrowHead = 'off';

The above code does the job, but it does not look good. Is it possible to represent the vector field like the below picture with 3D rods?

enter image description here

0 Answers
Related