%% Change the View Using a Vector
% Create a set of x-, y-, and z-coordinates and use them to plot a surface. Then label each axis.

[X,Y] = meshgrid(-5:.5:5);
Z = Y.*sin(X) - X.*cos(Y);
surf(X,Y,Z)
xlabel('X')
ylabel('Y')
zlabel('Z')

%
% Get the azimuth and elevation angles for this plot.

[caz,cel] = view

%
% Change the view by specifying v as the x- y- and z-coordinates of a vector, and return the new azimuth and elevation angles. The new angles are based on a unit vector pointing in the same direction as v.

v = [-5 -2 5];
[caz,cel] = view(v)

% Copyright 2018 The MathWorks, Inc.