Matlab中2D绘图的动画(Animation of 2D plot in Matlab)

编程入门 行业动态 更新时间:2024-10-26 09:35:14
Matlab中2D绘图的动画(Animation of 2D plot in Matlab)

我有一个设置,使用11个探头以一定间隔测量一台设备的温度曲线,我希望制作一个关于轮廓如何演变的动画图。 我将温度数据放在一个简单的m-by-n矩阵(约11x50000)中,其中每列代表一个探针,每行代表一组新的测量值。 它是针对一个简单的0:1:10矢量绘制的,以查看温度凸起如何随时间移动。

这在Matlab中是否可行?如果是这样的话怎么样? 我一直浏览了很多而没有发现任何有用的东西。 对不起,如果有任何现有的帖子,我没有偶然发现。

编辑:为插图添加的图像。 图像中的图是来自我希望动画的矩阵的各行的图。 示例图在测量中间隔约2分钟。 我所寻求的是有一个动画图形,显示温度凸起如何增长并沿y轴移动。 同样重要的是,我希望导出这个动画人物用于演示文稿。

matlab中的变种

I have a setup that measures the temperature profile of a piece of equipment at an interval using 11 probes and I wish to make an animated plot for how the profile evolves. I have my temperature data in a simple m-by-n matrix (about 11x50000) where each column represents a probe and each row represents a new set of measurements. It is to be plotted against a simple 0:1:10 vector to see how a temperature bulge moves over time.

Is this even possible in Matlab and if so how? I have been browsing around for quite a bit without finding anything useful. Sorry if there are any existing posts I haven't stumbled upon.

Edit: Image added for illustration. The plots in the image are plots of individual rows from the matrix i wish to animate. The example plots are about 2 minutes apart in the measurements. What I seek is to have a single animated figure that shows how the temperature bulge grows and shifts along the y-axis. Equally important, I wish to export this animated figure for use in a presentation.

vars in matlab

最满意答案

如果我理解您的问题,您可以尝试以下方法:( 进一步修改最后评论后的代码)

% Generate example data data=randi(10,1,100); data=[data;randi(10,1,100)+10] data=[data;randi(10,1,100)+20] data=[data;randi(10,1,100)+30] data=[data;randi(10,1,100)+40] t=1:101; h_fig=figure axes plot(data(:,1),t(1)) grid on xlim([0 100]) % legend(the_legend) hold on for i=1:100-1 tmp_h=plot(data(i,:),[1:5],'-d') M(i)=getframe(h_fig); pause(.3) delete(tmp_h) end movie2avi(M,'testMovie2______.avi','fps',3)

希望这可以帮助。

If I've understand yor question, you might try the following: (further modified the code following the last comment)

% Generate example data data=randi(10,1,100); data=[data;randi(10,1,100)+10] data=[data;randi(10,1,100)+20] data=[data;randi(10,1,100)+30] data=[data;randi(10,1,100)+40] t=1:101; h_fig=figure axes plot(data(:,1),t(1)) grid on xlim([0 100]) % legend(the_legend) hold on for i=1:100-1 tmp_h=plot(data(i,:),[1:5],'-d') M(i)=getframe(h_fig); pause(.3) delete(tmp_h) end movie2avi(M,'testMovie2______.avi','fps',3)

Hope this helps.

更多推荐

本文发布于:2023-07-19 20:44:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1186704.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:动画   Matlab   plot   Animation

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!