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

    %% Create 3-D Quiver Plot
% Define the data.

% Copyright 2015 The MathWorks, Inc.

x = -3:0.5:3;
y = -3:0.5:3;
[X,Y] = meshgrid(x, y);
Z = Y.^2 - X.^2;
[U,V,W] = surfnorm(Z);

%%
% Plot vectors with components |(U,V,W)| at points that are
% equally spaced in the _x_-direction and _y_-direction with heights
% determined by |Z|.
figure
quiver3(Z,U,V,W)
view(-35,45)