Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions nanRXY.m
Original file line number Diff line number Diff line change
@@ -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);
% [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