how to plot repeating steps graph real time/animated
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Young Woo Kim
el 20 de En. de 2023
Comentada: Mathieu NOE
el 25 de En. de 2023
the picture is sideways but
Is there a way to animate this sort of graph?
so far I have:
clc, clearvars
h = animatedline;
axis([0,5*pi,0.8,1])
x = linspace(0,5*pi,5000);
y = sin(x);
posY=y(y>0.8);
posX=x(y>0.8);
for k = 1:length(x)
addpoints(h,posX(k),posY(k));
% scatter(posX(k),posY(k));
plot (posX,posY,'.');
end
this is a partial plot of a sine wave but i would like to do a partial plot of a graph like the one I've drawn. Thank you in advance.
0 comentarios
Respuesta aceptada
Mathieu NOE
el 20 de En. de 2023
hello
maybe this
%% create animatedline object / handle
figure
h1 = animatedline;
h1.Marker = '*';
h1.Color = [1 0 1];
%% dummy data
x = (1:250);
y = 0.5*(1-square(0.25*x));
axis([0 max(x)*1.1 -0.2 1.2]);
for ci=1:length(x)
addpoints(h1,x(ci),y(ci));
pause(0.1);
drawnow
end
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Animation en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!