简体   繁体   中英

Animation of 2D plot in 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

变数

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM