コード
clear; close all; xs = []; ts = []; t=0; dt = 0.1; maxn = 50; while(1) ts = horzcat(ts,t); x = sin(t); xs = horzcat(xs,x); if(length(xs)>maxn) ts = ts(2:end); xs = xs(2:end); end t = t+dt; plot(ts,xs); xlim([ts(1),ts(1)+dt*maxn]); ylim([-1,1]); drawnow; pause(dt); end
