MATLAB: Simultaneous graph animations issue

animationgraph

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

Best Answer

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