Use same scale for several quiver3 plots on a single figure

13 views (last 30 days)
Hello,
I would like to plot 2 different quiver3 on a single figure so I can compare direction and amplitude of delta's vs direction and amplitude of residuals. Problem is that it seems that each quiver3 plot is sort of optimized to make the arrows or each quiver3 look as large as possible.
What I would like to achieve is: if the amplitude of an arrow from quiver plot A is 100X smaller than its corresponding arrow on quiver plot B, then it appears a 100X smaller on the quiver plot. It is not the case at the moment, both arrows from plots A and B have about the same length.
Here is my code:
X = [-0.0480 0.0480 -0.0400 0.0400]';
Y = [0.0050 0.0050 -0.0050 -0.0050]';
Z = [0 0 0 0]';
deltaX =[0 0 0 0]';
deltaY =[0 0 0 0]';
deltaZ = [9.2e-07 ; 8.2e-07 ; 9.7e-07 ; 8.9e-07];
resX = [0 0 0 0]';
resY = [0 0 0 0]';
resZ = [-1.0e-08 ; 1.0e-08 ; -8.3e-09 ; 8.4e-09];
deltaPlots = quiver3(X, Y, Z, deltaX, deltaY, deltaZ);
hold on
residualPlots = quiver3(X, Y, Z, resX, resY,resZ);
hold off
And here is the result:
Capture.PNG
In the circled pairs of arows, i expect the orange arrow to be 100X shorter than the blue one, but it's not the case. How can I make that happen?
Thanks!
  1 Comment
Mohammad reza Hasanpour
Mohammad reza Hasanpour on 1 Mar 2022
I have the same problem with quiver too. Even when I uncheck or switch the auto scale off, the vectors dissapears.

Sign in to comment.

Accepted Answer

Simon Chan
Simon Chan on 1 Mar 2022
Adjust the scale manually for the combined quiver3 plot.
However, since the residual ones are 100X shorter than the delta ones, they are almost impossible to see. So I use Linewidth=20 to prove they are exist,
X = [-0.0480 0.0480 -0.0400 0.0400]';
Y = [0.0050 0.0050 -0.0050 -0.0050]';
Z = [0 0 0 0]';
deltaX =[0 0 0 0]';
deltaY =[0 0 0 0]';
deltaZ = [9.2e-07 ; 8.2e-07 ; 9.7e-07 ; 8.9e-07];
resX = [0 0 0 0]';
resY = [0 0 0 0]';
resZ = [-1.0e-08 ; 1.0e-08 ; -8.3e-09 ; 8.4e-09];
figure(1)
subplot(2,2,1)
quiver3(X, Y, Z, deltaX, deltaY, deltaZ,1,'b');
title('deltaPlots');
subplot(2,2,3)
quiver3(X, Y, Z, resX, resY,resZ,1,'r');
title('residualPlots');
subplot(2,2,[2,4])
deltaPlots = quiver3(X, Y, Z, deltaX, deltaY, deltaZ,1,'b');
hold on;
residualPlots = quiver3(X, Y, Z, resX, resY,resZ,max(resZ)/max(deltaZ),'r','LineWidth',20);
hold off;
title('deltaPlots & residualPlots');

More Answers (0)

Categories

Find more on Vector Fields in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!