Animation graph with the slider

2 次查看(过去 30 天)
martin martin
martin martin 2019-4-10
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 个评论
martin martin
martin martin 2019-4-10
I tried simple GUI with only with axis and slider, but I don't know how to write it correctly.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Animation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by