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
Mostafa Salah
Mostafa Salah 2020년 4월 16일
Anything, i just need to animation figure in gui like wave moving

댓글을 달려면 로그인하십시오.

채택된 답변

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
  댓글 수: 2
Geoff Hayes
Geoff Hayes 2020년 4월 16일
It can be...so long as your GUI has an axes you can make sure the plot, xlim, and ylim functions are set fot that axes.

댓글을 달려면 로그인하십시오.

추가 답변 (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