mat=readmat('data.txt');
rmat=diff(log(mat(180:1000,633:640)));
rmat=delzeros(rmat);
rmat=flipud(rmat);
DecayFactor = 1;
WindowLength = 50;

[ExpReturn, ExpCovariance, NumEffObs] = ewstats(rmat, DecayFactor, WindowLength)
STDVec = sqrt(diag(ExpCovariance)); %  The correlation matrix is :
ExpCorrelation = ExpCovariance./( STDVec*STDVec' );

x1=[1:length(rmat)];
x2=[1:length(ExpCorrelation)];

plot(x1,rmat,'-');
meshc(x2,x2,ExpCorrelation);
