Matlab-view function

MATLAB provides the function view to set the viewpoint. The calling format is:
view (az, el)
az is the abbreviation of azimuth (azimuth), and EL is the abbreviation of elevation (elevation). They are all in degrees. The default viewpoint of the system is defined as an azimuth angle of -37.5° and an elevation angle of 30°.
When the x-axis is parallel to the observer's body and the y-axis is perpendicular to the observer's body, az=0; starting from this point, move clockwise around the z-axis, az is positive, and counterclockwise is negative.

EL is the angle formed by the observer's eye with the xy plane.
When the observer's eyes are on the xy plane, el=0; upward el is positive, downward is negative; the
following are some examples:
AZ = -37.5, EL = 30 is the default three-dimensional viewing angle.
AZ = 0, EL = 90 is a two-dimensional viewing angle. Looking down from the top of the graph, it shows the xy plane.
AZ = EL = 0 shows the xz plane.
AZ = 180, EL=0 is the xz plane seen from the back.
VIEW( 2) Set the default 2D viewing angle, AZ = 0, EL = 90.
VIEW(3) Set the default 3D viewing angle, AZ = -37.5, EL = 30.

VIEW([XYZ]) sets the view of the Cartesian coordinate system, the length of the [XYZ] vector is ignored.
[AZ,EL] = VIEW returns the current azimuth and elevation angle.
Example 1: Draw multimodal surface from different viewpoints

subplot(2,2,1);mesh(peaks);
    view(-37.5,30);          %指定子图1的视点
    title('azimuth=-37.5,elevation=30')
    subplot(2,2,2);mesh(peaks);
    view(0,90);            %指定子图2的视点
    title('azimuth=0,elevation=90')
    subplot(2,2,3);mesh(peaks);
    view(90,0);             %指定子图3的视点
    title('azimuth=90,elevation=0')
    subplot(2,2,4);mesh(peaks);
    view(-7,-10);            %指定子图4的视点
    title('azimuth=-7,elevation=-10')

Example 2: Rotate to observe multimodal function surface

mesh(peaks); %绘制多峰函数
  
el=30;  %设置仰角为30度。
for az=0:1:360  %让方位角从0变到360,绕z轴一周
    view(az,el);
    drawnow;
end

az= 0;   %设置方位角为0
for el=0:1:360   %仰角从0变到360
    view(az,el);
    drawnow;
end

Guess you like

Origin blog.csdn.net/Williamcsj/article/details/106985633