Can I make addpoints function show me more than one curve in ONE figure ?
5 views (last 30 days)
I asked this question https://www.mathworks.com/matlabcentral/answers/1771360-if-for-loop-repeated-itself-many-times-can-i-plot-what-calculated-inside-for-loop-in-one-curve
and got the answer from @ Walter Roberson, but now I modified the question as in the code below,,Can I use the addpoints function to show me
x1(i), x2(i), x3(i), and x4(i)
in ONE figure BUT seperated (Splitted curves in one figure) ?
Thanks in advance
Steven Lord on 24 Aug 2022
So you want multiple animated lines in the same figure? That's easy, just use multiple animatedline objects.
x = 0:360;
axis([0 360 -1 1]);
s = animatedline('Color', 'r', 'DisplayName', 'sine');
c = animatedline('Color', 'c', 'DisplayName', 'cosine');
for k = 1:numel(x)
addpoints(s, x(k), sind(x(k)));
addpoints(c, x(k), cosd(x(k)));