how to scale arrows

5 views (last 30 days)
MAJED
MAJED on 24 Jun 2014
Answered: Star Strider on 25 Jun 2014
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

Answers (1)

Star Strider
Star Strider on 25 Jun 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).

Categories

Find more on Programming 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!