pca - Matlab: Principle component analysis on signal (spectral unmixing) -


i have spectrum (wavelength(x) versus absorption(y)) mix of 2 signals (xa,ya) , (xb,yb). trying use pca (code found online) unmix signals in (x,y):

%step 1, input data numdata=length(data(:,1)); x=data(:,1); y=data(:,1);  %step 2, finding mean , subtracting xmean=mean(x); ymean=mean(y);  xnew=x-xmean*ones(numdata,1); ynew=y-ymean*ones(numdata,1);  subplot(3,1,1); plot(x,y, 'o'); title('original data');  %step 3, covariance matrix covariancematrix=cov(xnew,ynew);  %step 4, finding eigenvectors [v,d] = eig(covariancematrix); d=diag(d); maxeigval=v(:,find(d==max(d)));   %step 5, deriving new data set %finding projection onto eigenvectors  finaldata=maxeigval'*[xnew,ynew]'; subplot(3,1,2); stem(finaldata, 'displayname', 'finaldata', 'ydatasource', 'finaldata'); title('pca 1d output ') %we classification subplot(3,1,3); title('final classification') hold on i=1:size(finaldata,2)     if  finaldata(i)>=0         plot(x(i),y(i),'o')         plot(x(i),y(i),'r*')      else         plot(x(i),y(i),'o')         plot(x(i),y(i),'g*')     end  end 

how best apply pca output unmix (y) components ya , yb? don't have experience pca , cannot find tutorials online application. best generate eigenvectors training spectrum , compare test spectrum? thanks

enter image description here

section 3.3 of thesis informative: https://brage.bibsys.no/xmlui//bitstream/handle/11250/2371385/12296_fulltext.pdf?sequence=1&isallowed=y

"pca not classification method done based on knowledge of absorption spectra belonged material. pca can, however, used tool in classification. in order so, 1 needs training data. pca performed on training data, , and test data projected on basis of training data. called pca decomposition."

so think can use above code starting point.


Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -