EOF的源程序 MATLAB

上传人:回**** 文档编号:123789089 上传时间:2022-07-23 格式:DOC 页数:12 大小:42KB
收藏 版权申诉 举报 下载
EOF的源程序 MATLAB_第1页
第1页 / 共12页
EOF的源程序 MATLAB_第2页
第2页 / 共12页
EOF的源程序 MATLAB_第3页
第3页 / 共12页
资源描述:

《EOF的源程序 MATLAB》由会员分享,可在线阅读,更多相关《EOF的源程序 MATLAB(12页珍藏版)》请在装配图网上搜索。

1、.com mssa.rar EEOF.M function E,V,A,C=eeof(X, M, convert) % Syntax: E,V,A,C=eeof(X, M); E,V,A,C=eeof(X, M, 1); % This function performs an extended empirical orthogonal % function (EEOF) analysis of matrix X, for embedding dimension M. % Each of the L columns of X is a time series of length N. % % R

2、eturns: E - eigenfunction matrix. (LM by LM) % V - vector containing variances (unnormalized eigenvalues). % A - matrix of principal components. % C - lag-covariance matrix. % % V is ordered from large to small: E and A are sorted accordingly. % % Note that X is assumed to be centered. To center the

3、 data, use % the commands: % r,c=size(X); X=X-ones(r,1)*mean(X); before running EEOF. % If you also want to standardize the data, use: % X=X./(ones(r,1)*std(X);. % % If a third argument is supplied, the eigenfunctions/values will % be reordered into the same format as MSSA output - i. e. L blocks %

4、of size M rather than M blocks of size L. % % This function provides the same output, within numerically determined % limits, as MSSA methods using Broomhead-King type covariance estimation: % it is intended as a check on those functions. % % Note that this function is *extremely* computationally in

5、tensive % for large matrices and lags. For example, if X is 1000 by 1000, % and M = 5, EEOF will take about 10 hours on a Cray YMP! Inputting % a subset of the PCs of X rather than the full data matrix can % substantially reduce the computational load. % % Written by Eric Breitenberger. Version date

6、 1/11/96 % Please send comments and suggestions to % N,L=size(X); if M*L=N-M+1, disp(Warning: Covariance matrix may be ill-conditioned.), end % Create the extended matrix: T=zeros(N-M+1,M*L); for i=1:M T(:,L*(i-1)+1:L*i)=X(i:N-M+i,:); end % Compute the eigenvectors/values of the covariance matrix: C

7、=(T*T)/(N-M+1); clear X E,V=eig(C); V=diag(V); A=T*E; % compute principal components if nargin=3 % Prepare MSSA-style output: % sort E,V,C, and A from M blocks of L to L blocks of M. ind=1:L:(M-1)*L+1; for i=1:L, index=index ind+i-1; end E=E(index,index); V=V(index); % sort the covariance matrix and

8、 PCs: C=C(index,index); A=A(:,index); end % Sort eigenvalues/vectors/PCs in descending order: V,ind=sort(-V); V=-V; E=E(:,ind); A=A(:,ind); 窗体底端.com mssa.rar EOF.Mfunction F,L,B=eof(X,n,s); % EOF calculates the empirical orthogonal functions % and amplitudes (principal components) of the data matrix

9、 X. % Syntax: F,L,B=eof(X); F,L,B=eof(X,.9,norm); % % Input: X - data matrix. For a standard (S-mode) EOF analysis, % the columns of X are time series, while the rows % are spatial maps. The eigenfunctions in this case % will be spatial patterns, and the principal % components are time series. % n -

10、 number of eigenfunctions to return (optional). % If n is less than 1, it is interpreted as % a fractional variance (e. g. n=.9), and enough % eigenvectors are returned to account for n*100% % of the variance. The default is to return all EOFs. % s - Normalization option. If s=norm, then each % colu

11、mn of X will be normalized (assigned % unit variance). If s is not specified, the % data are not normalized. % % Output: F - eigenfunction matrix (columns are eigenvectors). % L - vector of eigenvalues.(all eigenvalues are returned) % B - principal components matrix. % % Written by Eric Breitenberge

12、r. Version date 1/11/96 % Please send comments and suggestions to % r,c=size(X); if cr, disp(Warning: Covariance matrix may be ill-conditioned.), end if nargin=1 n=c; s=none; elseif nargin=2 if isstr(n) s=n; n=c; else s=none; end end X=X-ones(r,1)*mean(X); % center the data if s=norm X=X./(ones(r,1)

13、*std(X); % normalize elseif s=none error(Improper normalization option. Please check inputs.) end S=X*X; % compute the covariance matrix F,L=eig(S); clear S % sort eigenvectors, eigenvalues L,i=sort(diag(-L); L=-L; F=F(:,i); % figure out how many eigenvectors to keep: if n=var); n=i(1); end if cn, F

14、=F(:,1:n); end % keep only first n eigenvectors B=X*F; % calculate principal components (first n) .com mssa.rar EOFCENT.Mfunction F,L,B=eofcent(X,n); % EOF calculates the empirical orthogonal functions % and amplitudes (principal components) of the data matrix X. % Syntax: F,L,B=eof(X); F,L,B=eof(X,

15、.9); % % Input: X - data matrix. For a standard (S-mode) EOF analysis, % the columns of X are time series, while the rows % are spatial maps. The eigenfunctions in this case % will be spatial patterns, and the principal % components are time series. % n - number of eigenfunctions to return (optional

16、). % If n is less than 1, it is interpreted as % a fractional variance (e. g. n=.9), and enough % eigenvectors are returned to account for n*100% % of the variance. The default is to return all EOFs. % % Output: F - eigenfunction matrix (columns are eigenvectors). % L - vector of eigenvalues.(all ei

17、genvalues are returned) % B - principal components matrix. % % EOFCENT does the same thing as EOF, but does not allow the data matrix to % be modified within the function, thus avoiding the memory penalty of passing % the large data matrix into the function. If you want to center or % standardize th

18、e data, you must do it in the main workspace before calling % EOFCENT The commands r,c=size(X); X=X-ones(r,1)*mean(X); will center the % data. If you then want to standardize the data, use X=X./(ones(r,1)*std(X);. % % Written by Eric Breitenberger. Version date 1/11/96 % Please send comments and sug

19、gestions to % r,c=size(X); if cr, disp(Warning: Covariance matrix may be ill-conditioned.), end if nargin=1 n=c; end S=X*X; % compute the covariance matrix F,L=eig(S); clear S % sort eigenvectors, eigenvalues L,i=sort(diag(-L); L=-L; F=F(:,i); % figure out how many eigenvectors to keep: if n=var); n=i(1); end if cn, F=F(:,1:n); end % keep only first n eigenvectors B=X*F; % calculate principal components (first n) 窗体底端窗体底端

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!