principal component analysis loading plots *Advanced*

6 views (last 30 days)
Hi all,
I am wondering if there is anyone here that is really good with PCA on Matlab and coding. having an issue with my current PCA plot not showing the wavenumber in relation to absorbance on this plot. My PCA involves taking two different spectra and analysing their absorbance with respect to what kind of group of acrylic paint they come from. My program gives the first image showing a flat PCA plot with No PC3 component since the principal component of the wavenumber was not included.
I want to replicate something shown from Image 2 with my PCA plots where the different spectra are shown including the principal component of wavenumber.
I am unsure how to theoretically do this on Matlab?
I'm sorry but I'm going to have to attach my entire code here to show how I managed to graph this.
If this huge chunk of code is hard to interpret I can send some more data and show step by step how this program works.
Thanks for the help
file=readmatrix('Set_13_14.xlsx') %File read
%a = ones(1682,1) + (0:2); % change 4 to 1682 for your data
%grp = categorical(a(:), [1 2 3], ["Akzo", "Akzoo", "Akzooo"]) %Sets the different groups used such as Set10 and Set11 for IR spectra
part1 = repmat({'Set'},1682,1);
part2 = repmat({'Sett'},1601,1);
%part3 = repmat({'Settt'},1682,1);
grp = categorical([part1; part2]);
semilogy(diag(S), 'k-o','LineWidth',2.5)
set(gca,'FontSize',15),axis tight, grid on
set(gca,'FontSize',15), axis tight, grid on
figure, hold on
for i=1:size(obs,1)
if grp(i)=='Set' %Decides which group will be used from the categorical array
elseif grp(i)=='Sett'
%elseif grp(i)=='Settt'
xlabel('PC1'), ylabel('PC2'), zlabel('PC3')
view(85,25), grid on, set(gca,'FontSize',15)

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!