diff --git a/nanRXY.m b/nanRXY.m index 00a52ea..74971ce 100644 --- a/nanRXY.m +++ b/nanRXY.m @@ -1,15 +1,7 @@ function [Rxy,Rxx,Ryy,Ryx] = nanRXY(X,Y) -D=size(X,1); -RXY=nancov([X.' Y.'],'pairwise'); -Rxx=RXY(1:D,1:D); -Ryy=RXY(D+1:end,D+1:end); -Rxy=RXY(1:D,D+1:end); -if nargout==4, Ryx=RXY(D+1:end,1:D); end - -% D=size(X,1); -% RXY=nancov([X.' Y.'],'pairwise'); -% Rxx1=RXY(1:D,1:D); -% Rxx2=RXY(2*D+1:3*D,2*D+1:3*D); -% -% Ryy=RXY(D+1:2*D,D+1:); -% Rxy=RXY(1:D,D+1:end); \ No newline at end of file +% [Rxy,Rxx,Ryy,Ryx] = nanRXY(X,Y) computes covariance matrixes taking NaN into account. +X = X.'; Y = Y.'; % this just because the rest of the doce assumes it this way. +Rxx=nancov(X,'pairwise'); +Ryy=nancov(Y,'pairwise'); +for i=1:size(X,2), for j=1:size(Y,2), c=nancov(X(:,i),Y(:,i)); Rxy(i,j)=c(1,2); end; end; +if nargout==4, Ryx=Rxy'; end