www.gusucode.com > vision 源码程序 matlab案例代码 > vision/CreateAnAnimatedCameraPlotExample.m

    %% Create Animated Camera Plot
% Plot a camera pointing along the _y_-axis.
    R = [1     0     0;
         0     0    -1;
         0     1     0];
%% 
% Set the opacity of the camera to zero for faster animation.
    cam = plotCamera('Location',[10 0 20],'Orientation',R,'Opacity',0);
%%  
% Set the view properties.
    grid on
    axis equal
    axis manual
%% 
% Make the space large enough for the animation.
    xlim([-15,20]);
    ylim([-15,20]);
    zlim([15,25]);
%% 
% Rotate the camera about the camera's _y_-axis.
    for theta = 0:pi/64:10*pi
        T = [cos(theta)  0  sin(theta);
                0        1      0;
             -sin(theta) 0  cos(theta)];
        cam.Orientation = T * R;
        cam.Location = [10 * cos(theta),10 * sin(theta),20];
        drawnow();
    end