how to scale arrows
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have this code for a vector field, the arrows keep getting crazier no mater what i do, can some one plese tell me how do i make them look nice and organized and same size
t1 = linspace(-1,500,10);
y1 = linspace(140,160,10);
[T,Y]=meshgrid(t1,y1);
DY=TribMod4(T,Y); DT=ones(size(DY));
scale = 1./sqrt(DT.^2+DY.^2);
p1=quiver(T,Y, 0.01.*DT, 0.001.*DY);
set(p1,'AutoScale','on', 'AutoScaleFactor', 0.08)
axis([-5 500 140 160])
hold on
[t,y]=ode45(@TribMod4,[0:0.51:900],147.971);
plot(t,y,'r')
ylabel('y')
xlabel('time (t)')
title('Direction field of function(2) with b=0.005')
thanks
0 Commenti
Risposte (2)
Star Strider
il 25 Giu 2014
You can turn autoscaling off by commenting the ‘set’ statement so it will not execute and instead calling quiver with:
quiver(x, y, dxda, dyda, 0)
The arrow lengths are controlled by the (u,v) vectors in the quiver documentation (here the (dxda,dyda) vectors), so while you can turn off autoscaling (that normally keeps the arrows from overlapping), according to the documentation and some of my experiments, you would have to control their lengths with (u,v).
0 Commenti
Adam Danz
il 26 Apr 2024
Quiver scaling can be tough to understand. We recently added the ScaleFactor property (R2024a) to help out. See this answer for 3 ways to control the scale of quiver arrows.
0 Commenti
Vedere anche
Categorie
Scopri di più su Vector Fields in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!