how to plot animated 2D figure using time axis and function in gui matlab ?

3 次查看(过去 30 天)
I'm trying to plot animated plot using many functions like addpoints but it doesnot work in guide .how can i solve this problem and plot 2d graph using function and time axis.
  5 个评论

请先登录,再进行评论。

采纳的回答

Geoff Hayes
Geoff Hayes 2020-4-16
Mostafa - perhaps the following can be adapted for your needs
x = linspace(-2*pi,2*pi,1000);
y = sin(x);
figure;
hPlot = plot(NaN,NaN);
xlim([min(x) max(x)]);
ylim([min(y) max(y)]);
for k = 1:length(x)
set(hPlot, 'XData', [get(hPlot,'XData') x(k)], 'YData', [get(hPlot,'YData') y(k)]);
pause(0.001);
end

更多回答(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