필터 지우기
필터 지우기

how could i animate a series as an animation ?

조회 수: 1 (최근 30일)
HADIMARGO
HADIMARGO 2018년 12월 13일
편집: Adam Danz 2020년 1월 28일
a function like :
just with loop

채택된 답변

Adam Danz
Adam Danz 2018년 12월 13일
편집: Adam Danz 2020년 1월 28일
Here's a demo below. First create the data, set up the figure, then loop through each coordinate to plot the next line segment (or dot); use drawnow to update the plot on each iteration.
Run this demo to watch the sin wave form.
% Create your data
x = 0:.1:4*pi;
y = sin(x);
% Create figure
figure
ah = axes;
% Set axis limits so they aren't continually adjusted
ylim([-1,1])
xlim([0, 4*pi])
hold(ah, 'on') %Hold the axis!
% loop through each point / line segment
for i = 2:numel(x)
plot(x(i-1:i), y(i-1:i), '-b')
drawnow %Update the plot!
end
Update: Here are better demos and more options I added 2 years later

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by