ftgram01.m

来自「Tucker, PARAFAC, GRAM, RAFA and misc. 2n」· M 代码 · 共 35 行

M
35
字号
function [Cunk,U,S,V]=ftgram01(Munk,Mcal,Ccal,noPC);
%function [Cunk,U,S,V]=ftgram01(Munk,Mcal,Ccal,noPC);
%
%This simple! version of GRAM (Generalized Rank Annihilation Method)
%calculates the unknown concentration of one specie in a sample
%matrix, provided a calibration matrix with the specie in
%known concentration.
%
%If you have an application where the complete GRAM is needed
%please let me know - then we might collaborate on it.
%
% Munk     : Matrix, containing specie in unknown conc. (r1 x r2)
% Mcal     : Matrix, containg specie in known conc. (r1 x r2)
%            also called the calibration matrix.
%            NOTE : The matrixes MUST have the same dimensions.
% Ccal     : Concentration of the specie in the calib. matrix.
% NoPC     : Number of PC's to use when decomposing.
% Cunk     : Concentration of the specie in the unknown matrix.
% U S V    : Factors used for calculating the solution.
% Author   : Claus A. Andersson, May 1995 
% Copyright: Food Technology,
%            Royal Veterinary & Agricultural University
%            Copenhagen, Denmark
% E-mail   : claus.andersson@pop.foodsci.kvl.dk

Z=Munk+Mcal;
[U S V]=svd(Z,0);
U=U(:,1:noPC);
S=S(1:noPC,1:noPC);
V=V(:,1:noPC);
K=(U')*Munk*V*pinv(S);
l=eig(K)';
Cunk=(Ccal*l(1,1))./(1.0-l(1,1));

disp('FTGRAM01: Execution ended.')

⌨️ 快捷键说明

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