Borrar filtros
Borrar filtros

Animation graph with the slider

2 visualizaciones (últimos 30 días)
martin martin
martin martin el 10 de Abr. de 2019
Comentada: martin martin el 10 de Abr. de 2019
Hello guys,
I have question, how can I animate this graph with slider? I just want to shift green point from the start to the end and again back (as on the picture) Any tips?
Best regards
clear, clc, close
t = linspace(0, 2*pi, 100);
x = sin(t);
% Set up first frame
h = figure('Color', 'white');
plot(t,x, 'LineWidth', 2)
xlabel('x')
ylabel('y')
hold on
h1 = plot(t(1),x(1),'go','LineWidth', 3, 'MarkerSize', 10);
for q = 1:length(t)
set(h1, 'XData', t(q), 'YData', x(q));
title(['Amplituda ', num2str(x(q)), ' mV.'])
pause(0.01)
end
for q = length(t):-1:1
set(h1, 'XData', t(q), 'YData', x(q));
title(['Amplituda ', num2str(x(q)), ' mV.'])
pause(0.01)
end
xxx.PNG
  1 comentario
martin martin
martin martin el 10 de Abr. de 2019
I tried simple GUI with only with axis and slider, but I don't know how to write it correctly.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by