Plot multiple quiver keeping arrows magnitude proportion
14 views (last 30 days)
Show older comments
Hello! I have a simple question I am not able to solve properly. I will simplify the problem to the following:
Consider two sets of vector field data:
- F1=(x,y,u,v)
- F2=(x,y,2*u,2*v).
When I plot these data, the size of the arrows coming from F2 are the same as the ones coming from F1, despite the fact that they are actually doble length.
If I want quiver to autoscale the arrows, but to mantain the magnitue proportion between arrows for different data sets (by different calls to quiver), what is the best way of doing it?
An test code to show this issue is:
n=30;
x=randn(n,1);
y=randn(n,1);
u=randn(n,1);
v=randn(n,1);
quiver(x,y,u,v,'b');
hold on
quiver(x,y,2*u,2*v,'r')
legend('F1','F2')
hold off
0 Comments
Answers (1)
Hrishikesh Borate
on 19 Jul 2021
Edited: Hrishikesh Borate
on 19 Jul 2021
Hi,
By default, the quiver function shortens arrows so they do not overlap. To disable automatic scaling so that arrow lengths are determined entirely by U and V, set the scale argument to 0. Following code demonstrates the same.
quiver(x,y,u,v,0,'b');
hold on
quiver(x,y,2*u,2*v,0,'r')
legend('F1','F2')
hold off
See Also
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!