⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 evolvfa.m

📁 偏最小二乘算法在MATLAB中的实现
💻 M
字号:
function [egf,egr] = evolvfa(xdat,plot,tdat);
%EVOLVFA performs forward and reverse evolving factor analysis.
% EVOLVFA calculates the eigenvalues of sub-matrices of (xdat)
% and returns results of the forward analysis in (egf) and
% reverse analysis in (egr). The optional input (plot) allows
% the user to supress plotting the results, and the optional
% input (tdat) is a vector to plot the results against.
% plot = 0 suppresses plotting of results.
% See also EFA_DEMO.
%
%I/O format is: [egf,egr] = evolvfa(xdat,plot,tdat);

[mx,nx] = size(xdat);
if nargin < 2
  plot  = 1;
end
if nargin < 3
  tdat  = [1:mx];
end
ydat    = xdat';
if mx > nx
  mmax  = nx;
else
  mmax  = mx;
end
egf     = zeros(mx,mmax);
egr     = zeros(mx,mmax);

for i=1:mx
  if i < nx
    zdat = ydat(:,1:i);
  else
    zdat = xdat(1:i,:);
  end
  s = svd(zdat,0);
  egf(i,1:min(i,mmax)) = s';
end
for i=mx:-1:1
  if mx-i+1 < nx
    zdat = ydat(:,i:mx);
  else
    zdat = xdat(i:mx,:);
  end
  s = svd(zdat,0);
  egr(i,1:min(mx-i+1,mmax)) = s';
end
clear s xdat ydat zdat

if plot ~= 0
  figure
  subplot(2,1,1)
  semilogy(tdat,egf,'-')
  ylabel('Eigenvalue')
  xlabel('Time')
  title('Forward Analysis')
  subplot(2,1,2)
  semilogy(tdat,egr,'-')
  ylabel('Eigenvalue')
  xlabel('Time')
  title('Reverse Analysis')
end

⌨️ 快捷键说明

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