So I'm currently attempting to animate multiple graphs on the same page using the comet() funtion, but when I run the functions together, they run one after the other,
each graph is modelled similarly but I'd like to have them all run simultaneously on the same graph. Is that possible for a comet() function?
x = a+b*cos(3*pi*t);
y = b+c*sin(3*pi*t);
plot(x,y);
comet(x,y);
hold on

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 5월 9일

0 개 추천

Try this example
h1 = animatedline('Color', 'r');
h2 = animatedline('Color', 'b');
x1 = linspace(0, 10, 100);
x2 = linspace(0, 10, 100);
y1 = sin(x1);
y2 = cos(x2);
axis([0,10,-1,1])
for k = 1:length(x1)
addpoints(h1,x1(k),y1(k));
addpoints(h2,x2(k),y2(k));
drawnow
end

추가 답변 (0개)

카테고리

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

질문:

2020년 5월 9일

답변:

2020년 5월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by