필터 지우기
필터 지우기

How create moving plot in MATLAB grader (in moodle)

조회 수: 2 (최근 30일)
adam soker
adam soker 2022년 4월 6일
답변: Cris LaPierre 2022년 4월 6일
I want students to create a moving plot like:
t = linspace(1,10,10);
for i=1:10;
pause(0.2);
x = i./t;
plot(x)
end
But in grader they can only see the last plot.

채택된 답변

Cris LaPierre
Cris LaPierre 2022년 4월 6일
You cannot create an animation in MATLAB Grader. At least not one that you will be able to see. This is because your code actually executes in the cloud, and only the final results are displayed in your browser. The plot you see is a jpeg of the final figure created by your code.

추가 답변 (1개)

Anirban Mandal
Anirban Mandal 2022년 4월 6일
편집: Anirban Mandal 2022년 4월 6일
You can use the following code for generating all the 10 plots. Let me know if this the solution you are looking for.
t = linspace(1,10,10);
for i=1:10;
pause(0.2);
x = i./t;
figure(i)
plot(x)
end
  댓글 수: 2
adam soker
adam soker 2022년 4월 6일
No, I want it in one figure, and I want it will be moving.
thank you.
Anirban Mandal
Anirban Mandal 2022년 4월 6일
Then you can use the comet function for a moving plot.
t = linspace(1,10,10);
for i=1:10;
pause(0.2);
x = i./t;
comet(x)
end

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by