MATLAB provides a function view that sets the viewpoint. Its invocation format is:
View (Az,el)
AZ is an abbreviation for azimuth (azimuth), and El is an abbreviation for elevation (elevation). They are all measured in degrees. The system default viewpoint is defined as azimuth -37.5°, elevation 30 °.
When the x-axis is parallel to the body of the observer, the y-axis is perpendicular to the observer's body, az=0, starting at this point, moving clockwise around the z-axis, AZ positive, and counter-clockwise negative.
EL is the angle at which the observer's eye is formed with the XY plane.
El=0 when the eye of the viewer is on the XY plane; The upward El is positive and downward is negative;
Here are some examples:
AZ = -37.5,el = 30 is the default three-dimensional view.
AZ = 0, EL =90 is a 2-dimensional view, looking down from the graph just above, showing the XY plane.
AZ = EL = 0 See the XZ plane.
AZ =180,el=0 is the XZ plane seen from the back.
View (2) sets the default two-dimensional view, AZ = 0, EL = 90.
View (3) Sets the default three-dimensional view, AZ = -37.5, EL = 30.
View ([x y z]) sets the angle of view of the Cartesian coordinate system, and the length of the [X y z] vector is ignored.
[Az,el] = VIEW Returns the current azimuth and elevation.
Example 1: Drawing a multi-peak function surface from different viewpoints
Subplot (2,2,1); mesh (peaks);
View ( -37.5,30); % Specifies the viewpoint of the sub figure 1
Title (' azimuth=-37.5,elevation=30 ')
Subplot (2,2,2); mesh (peaks);
View (0,90); % Specifies the viewpoint of the sub Figure 2
Title (' azimuth=0,elevation=90 ')
Subplot (2,2,3); mesh (peaks);
View (90,0); % Specifies the viewpoint of the sub Figure 3
Title (' Azimuth=90,elevation=0 ')
Subplot (2,2,4); mesh (peaks);
View ( -7,-10); % Specifies the viewpoint of the sub Figure 4
Title (' azimuth=-7,elevation=-10 ')
Example 2: Rotating to observe a multi-peak function surface
Mesh (peaks); % draw a multi-peak function
el=30; % set elevation to 30 degrees.
For az=0:1:360% change azimuth from 0 to 360, around z-axis for one week
View (Az,el);
Drawnow;
End
az= 0; % set bearing angle of 0
For el=0:1:360% elevation change from 0 to 360
View (Az,el);
Drawnow;
End
MATLAB set the function view of the viewpoint