% 给个例子参考哈clear allt=1:0.1:20;x=2*sin(t)+5;k=0;figure;plot(t,x);grid onwhile 1 if k>max(x) break; end k=k+0.2; axis([k+2*pi,k+4*pi,0,10]); %移动坐标系 pause(0.1);end