two animated lines simultaneously with different number of sample
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
alessandro mutasci
el 30 de Sept. de 2021
Comentada: Mathieu NOE
el 12 de Oct. de 2021
good evening, I'm trying to animate two line simultaneously, but I cant. I attach one if the last script, I even tried with only one for and the hold on after thefirst animatedline but still nothing.. I hope some can help me. I attach the 4 vector. x is with y; x1 with y1.
h = animatedline;
h1=animatedline;
axis([0,12,0,1])
numpoints = 2000;
numpoints1 = 20000;
x1=len_x1;
y1=len_y1;
x = len_x;
y = len_y;
a = tic; % start timer
% c=tic;
for k = 1:numpoints
addpoints(h,x(k),y(k))
b = toc(a); % check timer
if b > (1/100)
drawnow % update screen every 1/100 seconds
a = tic; % reset timer after updating
end
end
hold on
for j = 1:numpoints1
addpoints(h1,x1(j),y1(j))
b = toc(a); % check timer
if b > (1/10)
drawnow % update screen every 1/100 seconds
a = tic; % reset timer after updating
end
end
drawnow % draw final frame
0 comentarios
Respuesta aceptada
Mathieu NOE
el 30 de Sept. de 2021
hello
I am not sure to uderstand what kind of result you want to achieve , maybe this little demo can help you
clearvars
clc
figure
h1 = animatedline;
h1.Marker = '*';
h1.Color = [1 0.4 0];
h2 = animatedline;
h2.Marker = '+';
h2.Color = [0 1 0];
axis([0 2*pi -1.5 1.5])
% x, y data
n = 100;
x=linspace(0,2*pi,n);
y1 = sin(x);
y2 = cos(x);
% main loop
for ci=1:n
addpoints(h1,x(ci),y1(ci));
addpoints(h2,x(ci),y2(ci));
pause(0.01);
drawnow
end
7 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Animation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!