用于近红外光谱中 进行校正集和验证集近红外光谱的选择源码程序MATLAB - matlab算法设计 - 谷速源码
下载频道> 资源分类> matlab源码> 算法设计> 用于近红外光谱中 进行校正集和验证集近红外光谱的选择源码程序MATLAB

标题:用于近红外光谱中 进行校正集和验证集近红外光谱的选择源码程序MATLAB
分享到:

所属分类: 算法设计 资源类型:程序源码 文件大小: 2.46 KB 上传时间: 2019-12-01 22:09:43 下载次数: 4 资源积分:1分 提 供 者: jiqiren 20191201101033907
内容:
function m= spxy(X,y,Ncal)
%+++ Employ the Sample Set Partitioning Based on Joint X-Y Distance for selecting the representative samples;
%+++ X: a n x p matrix with n samples and p variables.
%+++ Ncal:number of calibration samples,no more than the total number of samples
%+++ m: sample index   
%+++ zhushi,Oct 13,2013.
dminmax = zeros(1,Ncal); % Inicializes the vector of minimum distances.
M= size(X,1); % Number of objects
samples = 1:M;
Dx = zeros(M,M); % Inicializes the matrix of X-distances.
Dy = zeros(M,M); % Inicializes the matriz de y-distances.
for i = 1:M-1
    xa = X(i,:);
    ya = y(i,:);
    for j = i + 1:M
        xb = X(j,:);
        yb = y(j,:);
        Dx(i, j) = norm(xa-xb);
        Dy(i, j) = norm(ya-yb);
     end
end
Dxmax = max(max(Dx));
Dymax = max(max(Dy));
D= Dx/Dxmax + Dy/Dymax; % Combines the X and y distances.
% D is an upper triangular matrix.
% D(i,j) is the distance between objects i and j (j > i).
[maxD,index_row] = max(D);
% maxD is a row vector containing the largest element for each column of D.
% index_row is the row in which the largest element of the column if found.
[dummy,index_column] = max(maxD);
% index_column is the column containing the largest element of matrix D.
m(1) = index_row(index_column);
m(2) = index_column;
for i = 3:Ncal
    pool = setdiff(samples,m);
% Pool is the index set of the samples that have not been selected yet.
    dmin = zeros(1,M-i + 1);
% dmin will store the minimum distance of each sample in “pool” with
% respect to the previously selected samples.
    for j = 1:(M-i + 1)
        indexa = pool(j);
        d = zeros(1,i-1);
        for k = 1:(i-1)
            indexb = m(k);
            if indexa < indexb
                 d(k) = D(indexa,indexb);
            else
                d(k) = D(indexb,indexa);
            end
        end
        dmin(j) = min(d);
      end
% At each iteration, the sample with the largest dmin value is selected.
      [dummy,index] = max(dmin);
       m(i) = pool(index);
end

文件列表(点击上边下载按钮,如果是垃圾文件请在下面评价差评或者投诉):

用于近红外光谱中 进行校正集和验证集近红外光谱的选择源码程序MATLAB/
用于近红外光谱中 进行校正集和验证集近红外光谱的选择源码程序MATLAB/code/
用于近红外光谱中 进行校正集和验证集近红外光谱的选择源码程序MATLAB/code/ks.m
用于近红外光谱中 进行校正集和验证集近红外光谱的选择源码程序MATLAB/code/spxy.m

关键词: 近红外 光谱 源码 程序 MATLAB

Top_arrow
回到顶部
联系方式| 版权声明| 招聘信息| 广告服务| 银行汇款| 法律顾问| 兼职技术| 付款方式| 关于我们|
网站客服网站客服 程序员兼职招聘 程序员兼职招聘
沪ICP备19040327号-3
公安备案号:沪公网安备 31011802003874号
库纳格流体控制系统(上海)有限公司 版权所有
Copyright © 1999-2014, GUSUCODE.COM, All Rights Reserved