close all;clc;clear; N=60; rand('state',0); % Author : Zhengjun Liu S=rand(1,2*N); pt=plot(1:N,S(1:N),'y','linewidth',2); hold on; plot([1,N],[0.5,0.5],'w','linewidth',1); set(gca,'color','b'); set(gcf,'DoubleBuffer','on'); while 1; S(end+1)=rand; S(1)=[]; set(pt,'YData',S(1:N)); pause(0.2); end