how to scale arrows
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
Star Strider
2014 年 6 月 25 日
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 件のコメント
Adam Danz
2024 年 4 月 26 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Vector Fields についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!