January 22nd, 2004, 12:33 pm
An idea is something like the following. The code plots the spread between to values.SZ = 1000;z = cumsum(randn(SZ,2)*chol([1 0.7;0.7 1]));t = 300;subplot(2,1,1)plot(1:t,z(1:t,1),1:t,z(1:t,2));subplot(2,1,2);hold onplot(z(1:t,1),z(1:t,2))point = plot(z(t,1),z(t,2));while(1) if t> SZ, break, end t = t + 1; subplot(2,1,1) hold off plot(1:t,z(1:t,1),1:t,z(1:t,2)); %remove old cross subplot(2,1,2) hold on delete(point); point = plot(z(t,1),z(t,2),'xr'); plot(z(t-1:t,1),z(t-1:t,2)) pause(1/5)end