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

📄 stdsslct.m

📁 偏最小二乘算法在MATLAB中的实现
💻 M
字号:
function [specsub,specnos] = stdsslct(spec,nosamps)
%STDSSLCT Selects subset of spectra for use in standardization
% Selects a subset of the given spectra based on leverage for
% use in developing transforms for instrument standardization.
% The inputs are the available spectra (spec) and the number
% samples to be selected (nosamps). The outputs are the matrix
% of spectra selected (specsub) and the sample numbers of the
% selected spectra (specnos). The I/O format is:
% [specsub,specnos] = stdsslct(spec,nosamps);

% Copyright
% Barry M. Wise
% 1994
[ms,ns] = size(spec);
r1 = mncn(spec);
subset = zeros(1,nosamps);
for i = 1:nosamps
  hat = r1*r1';
  [x subset(1,i)] = max(diag(hat));
  r0 = r1(subset(1,i),:);
  r1(subset(1,i),:) = zeros(1,ns);
  for j = 1:ms
    r1(j,:) = r1(j,:) - ((r0*r1(j,:)')/(r0*r0'))*r0;
  end
end
disp('The subset selected consists of the following samples:')
disp('  ')
disp(subset)
specnos = subset;
specsub = spec(subset,:);

⌨️ 快捷键说明

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