www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/PlotVectorVelocitiesExample.m

    %% Plot Vector Velocities
% Use |quiver| to display an arrow at each data point in |x| and |y| such that the
% arrow direction and length represent the corresponding values in |u| and
% |v|.

% Copyright 2015 The MathWorks, Inc.


[x,y] = meshgrid(0:0.2:2,0:0.2:2);
u = cos(x).*y;
v = sin(x).*y;

figure
quiver(x,y,u,v)