Plot multiple quiver keeping arrows magnitude proportion
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Hrishikesh Borate
am 19 Jul. 2021
Bearbeitet: Hrishikesh Borate
am 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
2 Kommentare
Siehe auch
Kategorien
Mehr zu Vector Fields finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!