필터 지우기
필터 지우기

Adjust the Motion Speed of animate Option in ezplot3

조회 수: 1 (최근 30일)
Kareem Elgindy
Kareem Elgindy 2022년 11월 7일
답변: Askic V 2022년 11월 15일
Consider
syms t; ezplot3(t.^2,sin(t),t,[-2,2],'animate')
How can I control the speed of motion in the animated plot?

채택된 답변

Askic V
Askic V 2022년 11월 15일
ezplot3 is not recommended function to use in Matlab any more.
There are other, maybe not that elegant ways of making animations, but the solution could be something like this:
% N -number of points, it can also be used to control speed
% insted of pause()
N = 100;
t = linspace(-2, 2, N);
x = t.^2;
y = sin(t);
z = t;
plot3(x,y,z)
grid on;
hold on;
p = plot3(x(1),y(1),z(1),'o','MarkerFaceColor','red');
hold off;
xlim([0, 4]); ylim([-1, 1]); zlim([-2, 2]);
time_step = 0.1; % parameter to control the speed
for k = 2:length(t)
p.XData = x(k);
p.YData = y(k);
p.ZData = z(k);
drawnow
pause(time_step)
end
I suggest you to look further in the Matlab documentation:
https://www.mathworks.com/help/matlab/animation-1.html

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by