matlab - 如何在同一 Canvas 上连续可视化matlab中的多个矩阵以制作视频?

标签 matlab visualization

我需要类似 this 的东西,但是我有很多描述二维电场随时间变化的矩阵。所以我希望矩阵可视化相互替换,以获得视频

最佳答案

我想给您一个示例代码,用于从一系列绘图生成动画 gif。您可以修改绘图以生成您喜欢的任何内容;例如您链接中的那个。

gifOutputName = 'sample.gif';

%# As an example, let us draw a 3-D plot
%# You can generalize it to anything you like
Z = peaks; surf(Z);
axis tight
set(gca,'nextplot','replacechildren');
for j = 1:20
    surf(sin(2*pi*j/20)*Z,Z)

    %# Grab the current frame
    RGB = frame2im(getframe(gcf));

    %# Reduce it to 256 colors since it's gonna be GIf image
    [IND, map] = rgb2ind(RGB, 256);

    if j == 1 % Vreate in the first step

        %# 'LoopCount' indicates how many times the animation will play, 
        %# Inf states infinity. Refer to "GIF-Specific Parameters" in the 
        %# documentation.
        imwrite(IND, map, gifOutputName, 'gif', 'LoopCount', Inf);

    else %# Otherwise, append it to the previous
        imwrite(IND, map, gifOutputName, 'gif', 'WriteMode', 'append');
    end
end
close %# Close the figure

enter image description here
(来源:ismailari.com)

关于matlab - 如何在同一 Canvas 上连续可视化matlab中的多个矩阵以制作视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10671724/

相关文章:

r - R:使用莱迪思和ggplot2的利弊是什么?

matlab - 在四个角点之间显示图像 Matlab

c++ - 如何检测测量水位的白色仪表板?

matlab - 使用 matlab 高效可视化大量点。

c++ - 使用 Qt 可视化(有向)图

r - 绘制带有噪声的函数

matlab - 两个图像之间的相似性度量

matlab - 在 Matlab 中声明函数递归序列

matlab - 按顺时针顺序检测非凸多边形的角坐标 MATLAB

visualization - 如果我知道 Kibana,我可以使用 Grafana 吗?