MATLAB: HOw can I change the size of the arrows

fieldvector

I did this code to plot a vector field, and i was wondering how can i change the size of the arrows?
t1 = linspace(-1,100,20);
y1 = linspace(-1,150,20);
[T,Y]=meshgrid(t1,y1);
DY=TribMod1(T,Y); DT=ones(size(DY));
scale = 1./sqrt(DT.^2+DY.^2);
quiver(T,Y, scale.*DT, scale.*DY);
axis([-1 100 -1 151])
ylabel('y')
xlabel('time (t)')
title('Direction field of function(1) with b=0.005')

Best Answer

Use the 'AutoScaleFactor' property:
% CREATE DATA:
a = linspace(0,6*pi);
x = exp(-0.1*a) .* cos(a);
y = exp(-0.1*a) .* sin(a);
da = diff([0 a]);
dxda = diff([0 x]) ./ da;
dyda = diff([0 y]) ./ da;
% PLOT:
figure(1)
subplot(2,1,1)
h1 = quiver(x, y, dxda, dyda)
set(h1,'AutoScale','on', 'AutoScaleFactor', 2)
axis equal square
title('Arrows 2')
subplot(2,1,2)
h2 = quiver(x, y, dxda, dyda)
set(h2,'AutoScale','on', 'AutoScaleFactor',0.5)
axis equal square
title('Arrows ½')
produces:
Related Question