Hello! I'm just getting started with matlab. Now I have some questions with animation creation. I have an array U1, size 101*101. I need to make an animation from the line graphs of each 20th column of this array. They need to come out one by one. I made an example of how it should look like, but I can't implement it. So far, I was only able to display the graphs of each line in one figure. plot(x, U1(:,1:20:end)) Please tell me how to create this animation or can you advise the literature where there are similar examples. Thank you!

 채택된 답변

Jon
Jon 2023년 4월 10일

1 개 추천

You could do something like this
% Make some example data
U1 = rand(101,101)
x = linspace(1,10,101);
% plot every 20th column of the data in a loop so it appears animated
tPause = 1; % pause time in seconds between displaying each curve
n = 20; % curve increments
numCol = size(U1,2); % number of columns in data matrix
numCurves = floor(numCol/n); % number of curves to be plotted
for k = 1:numCurves
plot(x,U1(:,k))
pause(tPause)
end

댓글 수: 2

Dana Bodart
Dana Bodart 2023년 4월 11일
Thank you, that is what I was looking for!
Jon
Jon 2023년 4월 12일
That's great. If this answers your question, please accept the answer so that others who might be interested will know that a solution is available

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Animation에 대해 자세히 알아보기

태그

질문:

2023년 4월 10일

댓글:

Jon
2023년 4월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by