PDA

查看完整版本 : 如何在Matlab中自动旋转3d指纹图?


poster
2019-12-10, 20:30
我在Matlab中有一个3D直方图。是否有可能自动旋转,即获得3D效果。我想将其显示为PowerPoint中3d直方图旋转的视频。

谢谢



回答:

一种比较麻烦的方法是使用view (http://www.mathworks.com/access/helpdesk/help/techdoc/ref/view.html)命令手动旋转图表。您可以使用此命令更新任何3D图的方位角和高程视图。

要创建视频,需要使用如下命令序列捕获绘图窗口(注意,您将获得灰色背景,因此您可能希望更改背景颜色):

% create figure and get handle to it (store handle in hf) hf = figure(1); % [create 3d plot] % Create file to hold the animation aviobj = avifile('mymovie.avi', 'compression', 'Cinepak'); % loop with some criteria for rotation while(...) % update view using view command view(az, el); % get Matlab to flush the drawing buffer (effectively forces a plot update) drawnow; % capture frame and write to the avi file aviobj = addframe(aviobj, hf); end % end loop % Close movie (flushes write buffer and finishes the video) aviobj = close(aviobj); 您可以使用没有avifile内容的相同策略,使用Matlab中的脚本来旋转绘图,尽管您可能希望使用pause命令来减慢帧更改的速度。



更多&回答... (https://stackoverflow.com/questions/2048177)