Filter löschen
Filter löschen

Animation graph with the slider

2 Ansichten (letzte 30 Tage)
martin martin
martin martin am 10 Apr. 2019
Kommentiert: martin martin am 10 Apr. 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 Kommentar
martin martin
martin martin am 10 Apr. 2019
I tried simple GUI with only with axis and slider, but I don't know how to write it correctly.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Animation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by