XY plot data interactively

2 ビュー (過去 30 日間)
Giulio
Giulio 2019 年 11 月 27 日
回答済み: Akira Agata 2019 年 11 月 28 日
Hello, I am looking for a function which works very similarly to plot(x,y) - i.e. takes two identical size arrays and plots them in a 2D graph - but instead of showing all the values of x and y at once, it plots them over time (i.e. the sequence of the corresponding elements in x and y) as if it was a video.
Thanks
Giulio

回答 (1 件)

Akira Agata
Akira Agata 2019 年 11 月 28 日
How about using animatedline function?
The following is an example:
h = animatedline('LineStyle','none','Marker','o');
axis([0,4*pi,-1,1])
x = linspace(0,4*pi,100);
y = sin(x);
for k = 1:length(x)
addpoints(h,x(k),y(k));
drawnow
end

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by