我会说这是您绘制的大量点导致减速。一种选择是下采样。您也可以使用较低级别的函数进行绘制(查看此相关帖子以比较 plot3/scatter3/line 性能)。
考虑以下针对速度优化的动画:
[X Y Z] = sphere(64);
X = X(:); Y = Y(:); Z = Z(:);
%# set-up figure
hFig = figure('Backingstore','off', 'renderer','zbuffer');
%# use lower-level function LINE
line(0.50*[X,X], 0.50*[Y,Y], 0.50*[Z,Z], 'LineStyle','none', 'Marker','.', 'MarkerSize',1, 'Color','r')
line(0.75*[X,X], 0.75*[Y,Y], 0.75*[Z,Z], 'LineStyle','none', 'Marker','.', 'MarkerSize',1, 'Color','g')
line(1.00*[X,X], 1.00*[Y,Y], 1.00*[Z,Z], 'LineStyle','none', 'Marker','.', 'MarkerSize',1, 'Color','b')
view(3)
%# freeze the aspect ratio to override stretch-to-fill behaviour
axis vis3d
%# fix the axes limits manually
%#set(gca, 'xlim',[-1 1], 'ylim',[-1 1], 'zlim',[-1 1])
axis manual
%# maybe even remove the tick labels
%set(gca, 'xticklabel',[], 'yticklabel',[], 'zticklabel',[])
%# animate (until figure is closed)
while ishandle(hFig); camorbit(0.9,-0.1); drawnow; end

请注意我们如何使用 Z-buffer渲染器,并关闭Backingstore属性。
编辑:
如果我理解正确,您要做的是录制截屏视频(使用第 3 方应用程序),同时手动旋转图形,但在您的情况下,这些手动旋转是“跳跃的”。另一方面,在 while 循环中使用 CAMORBIT/VIEW 为您的图形设置动画运行顺利......
我提出了另一种解决方案:首先使用鼠标旋转图形,然后在每一步(方位角、仰角)写入这些视图配置。然后您可以在录制视频时使用 VIEW 功能重播它们,例如:
v = [...]; %# matrix where each row specify Az/El of view
for i=1:size(v,1)
view( v(i,:) )
drawnow
end
缺点是您必须使用鼠标小步按下/旋转/释放(ROTATE3D 对象不公开鼠标运动事件)
我写了一个简单的函数来帮助你完成这个过程。它加载保存的图形,启用 3d 旋转,并在每一步跟踪中间位置。完成后,按“完成”按钮返回视图列表...
function v = rotationDemo(figFileName)
views = []; %# list of views (Az,El)
hFig = hgload(figFileName); %# load the saved figure
views(1,:) = get(gca,'View'); %# store initial view
%# add a button, used to terminate the process
hButton = uicontrol('Style','pushbutton', 'Position',[400 1 80 20], ...
'String','Done?', 'Callback',@buttonCallback);
set(hFig, 'Toolbar','figure') %# restore toolbar
%# start 3d rotation, and handle post-callback to record intermediate views
h = rotate3d(hFig); %# get rotation object
set(h, 'ActionPostCallback',@rotateCallback)
set(h, 'Enable','on') %# enable rotation
msgbox('Rotate the view step-by-step', 'rotate3d', 'warn', 'modal')
uiwait(hFig) %# wait for user to click button
delete(hButton) %# delete button on finish
set(h, 'Enable','off') %# disable rotation
v = round(views); %# return the list of views
%# callback functions
function rotateCallback(o,e)
views(end+1,:) = get(e.Axes,'View'); %# add current view to list
end
function buttonCallback(o,e)
uiresume(gcbf) %# uiresume(hFig)
end
end

可以调用上面的函数,然后重放动画:
v = rotationDemo('smooth_rotation.fig');
for i=1:size(v,1)
view(v(i,:))
drawnow
end
我们可以通过简单的插值来平滑过渡:
v = rotationDemo('smooth_rotation.fig');
n = size(v,1);
nn = linspace(1,n,100)'; %'# use 100 steps
vv = round( [interp1(v(:,1),nn) interp1(v(:,2),nn)] );
for i=1:size(vv,1)
view(vv(i,:))
DRAWNOW %# or PAUSE(..) to slow it down
end
作为旁注,我应该提到 ROTATE3D 和 CAMORBIT 具有不同的效果。ROTATE3D改变View
当前轴的属性,而CAMORBIT控制当前轴的相机属性CameraTarget
// 。CameraPosition
CameraUpVector