eofcorr.m

来自「蒙托卡罗模拟奇异谱分析」· M 代码 · 共 30 行

M
30
字号
function [c,C]=eofcorr(E,F);
% EOFCORR - examine correlations between two sets of eigenvectors.
% Syntax: [c,C]=eofcorr(E,F);
%
% Input:  E - a set (M by e) of e eigenvectors, each of length M.
%         F - a set (M by f) of f eigenvectors, each of length M.
%
% Output: c - a vector of length e, where the i-th element
%             contains the index of the eigenvector in F which
%             is best correlated with the i-th eigenvector in E.
%
%         C - a matrix of size e by f, where C(i,j) contains 
%             the correlation between eigenvectors E(:,i) and F(:,j).
%

[M,e]=size(E);
[N,f]=size(F);

if M~=N, error('Input arguments must have the same number of rows'), end

% Standardize:
E=E-ones(M,1)*mean(E);
F=F-ones(M,1)*mean(F);
E=E./(ones(M,1)*std(E)); 
F=F./(ones(M,1)*std(F));

C=(E'*F)./(M-1); 

[x,c]=max(abs(C'));

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?