Animation graph with the slider

2 views (last 30 days)
martin martin
martin martin on 10 Apr 2019
Commented: martin martin on 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 Comment
martin martin
martin martin on 10 Apr 2019
I tried simple GUI with only with axis and slider, but I don't know how to write it correctly.

Sign in to comment.

Answers (0)

Categories

Find more on Animation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!