0

我在 matlab 中有一个 3d 直方图。是否可以自动旋转它,即获得 3d 效果。我想在 PowerPoint 中将其显示为 3d 直方图旋转的视频。

谢谢

4

2 回答 2

1

view一个有点麻烦的方法是使用命令手动旋转图表。您可以使用此命令更新任何 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命令来减慢帧更改。

于 2010-01-12T13:27:38.883 回答
0

让我们确保我们在这里谈论的是同一件事。二维直方图将具有指定 X 和 Y 范围的 bin,并且计数将显示在 Z 轴上。3-D 直方图将在 X 和 Y 和 Z 范围内有 bin,计数以其他方式显示(颜色?)您需要对 3-D 直方图进行切片才能有意义。我假设您的意思是一个二维直方图,看起来像一堆从地下冒出来的块。

我认为将这个二维直方图制作成图像会更好,其中每个像素代表 X 和 Y 中的特定箱,颜色指定该箱中的计数。我认为该议案只会混淆数据。为此使用 image 或 imagesc 或 imshow 。另外,我会推荐一个基于强度的颜色图(>>colormap),比如春天或冬天。这使得差异更加明显。打开颜色栏(>>颜色栏)

于 2010-01-12T14:31:10.300 回答