📄 os2ref.m
字号:
function[RMSEC,RMSEP]=os2ref(Xcal,ycal,Xval,yval);% [RMSEC,RMSEP]=os2ref(Xcal,ycal,Xval,yval);% % Optimized scaling 2, T. V. Karstang, R. Manne, Chemolab 14 (1992) 165-173% y=(x*b)./(x*c), b-regression coefficient, c-scaling coefficient% % Testing through all the objects for detection of best reference. RMSEC/RMSEP values for every score is obtained.% Use bar(RMSEC) and bar(RMSEP)% Xcal: scores for calibration set: [T,P]=apca(X), % Xval: scores for val.set: Tv=X*P% % L. Stordrange 02.03.01, Uppdated 27.06.01[i,j]=size(Xcal);[v,w]=size(Xval);RMSEC=zeros(i,j);RMSEP=zeros(i,j);for t=1:j for k=1:i xnull=Xcal(k,1:t); ynull=ycal(k); Z=diag(ycal)*Xcal(:,1:t); Z(k,:)=zeros(1,t); ZX=[Z Xcal(:,1:t)]; xnull0=[xnull,zeros(1,t)]; % The final system of linear equations is denoted A*p=q A=[ZX'*ZX,xnull0';xnull0,0]; q=[zeros(t,1);-ynull*xnull';1]; p=A\q; % c=p(1:t); b=-p(t+1:2*t); %lamda=-p(2*j+1); yc=(Xcal(:,1:t)*b)./(Xcal(:,1:t)*c); ec=yc-ycal; RMSEC(k,t)=sqrt((ec'*ec)/i); yv=(Xval(:,1:t)*b)./(Xval(:,1:t)*c); ev=yv-yval; RMSEP(k,t)=sqrt((ev'*ev)/v); endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -