フィルターのクリア

How to plot animation plots?

531 ビュー (過去 30 日間)
Ajay Ganti
Ajay Ganti 2018 年 4 月 16 日
編集済み: Vishnu Keyen 2021 年 8 月 31 日
I have an array of size 2396160x1. It contains 2396160 values. Now i want to plot these values like an animation, in which the values will be plotted. I'm attaching a video link like that i want to do. https://www.youtube.com/watch?v=x_jvC89MMs8&feature=youtu.be&t=15m43s. please help me

回答 (2 件)

Wick
Wick 2018 年 5 月 2 日
If you're just looking to animate what the plot is doing like in the video, just include a 'drawnow' command inside a for loop.
If you want to create a movie from within MATLAB you can use the getframe and movie commands to capture the figure graphics to an animation.
You can also create a frame-by-frame animation by saving a series of PNG files and converting them to a movie with an external player (such as Quicktime) or you can write an animated GIF directly using the imwrite command. With the 'append' option for imwrite you can add multiple GIFs with a defined delay between frames. For the type of growing bar graph like in the YouTube video, an animated GIF is going to be a lot smaller than any "normal" movie file.

Vishnu Keyen
Vishnu Keyen 2021 年 8 月 31 日
編集済み: Vishnu Keyen 2021 年 8 月 31 日
g=sin([1:0.1:10*pi]);
for i = 1:length(g)
figure(1)
if i ~=length(g)
plot(1:i,g(1,1:i),'-b');
else
plot(1:i,g(1,1:i),'-b*')
end
if i>=50
axis([i-50 i+50 min(g(1,:)) max(g(1,:))])
else
axis([0 i+50 min(g(1,:)) max(g(1,:))])
end
%pause(0.1)
drawnow
end

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by