Hi COMM, How can I hold only one plot while updating the rest in a figure ? E.g. I want to keep (x,f) plot fixed , while keeping the current value for the animated plot

1 visualización (últimos 30 días)
SSmin=0;
SSmax=19;
x=SSmin:0.01:SSmax;
f= (x).*sin(x) +20;
figure
plot(x,f)
hold on
for k=1:length(x)
plot(x(k),f(k),'or')
axis([SSmin SSmax 0 30])
pause(0.2)
end

Respuestas (1)

VBBV
VBBV el 20 de En. de 2022
Editada: VBBV el 20 de En. de 2022
for k=1:length(x)
plot(x(1:k),f(1:k),'or')
axis([SSmin SSmax 0 30])
pause(2)
end
Check with this
  2 comentarios
Mahmud Hamed
Mahmud Hamed el 20 de En. de 2022
Editada: Mahmud Hamed el 20 de En. de 2022
This is not working VBBV, Its just delaying the pause time
VBBV
VBBV el 20 de En. de 2022
Editada: VBBV el 20 de En. de 2022
h = animatedline('MaximumPoints',length(x),'Marker','or')
for k=1:length(x)
addpoints(h,x(k),f(k))
axis([SSmin SSmax 0 35])
drawnow
end
you can use drawnow to animate the line. Check also animate page for more information how to animate

Iniciar sesión para comentar.

Categorías

Más información sobre Animation en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by