Filter löschen
Filter löschen

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

3 Ansichten (letzte 30 Tage)
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 Kommentare
Mostafa Salah
Mostafa Salah am 16 Apr. 2020
Anything, i just need to animation figure in gui like wave moving

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Geoff Hayes
Geoff Hayes am 16 Apr. 2020
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 Kommentare
Geoff Hayes
Geoff Hayes am 16 Apr. 2020
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.

Melden Sie sich an, um zu kommentieren.

Weitere 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