Importing 3 spectrum data, plot representative spectrum for each sample all in same figure
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have spectrum data from three different samples. I am supposed to import the wavelength and absorbance spectra data from each file, make a reresentative spectrum from each sample, and plot in the same figure. Please help. Here is the code for two of my files.
clear
test=imread('curc_1.jpeg');
test2=rgb2gray(im2double(test));
image(test);
test_spectrum=sum(test2(1750:2500,1800:3000),1);
figure();plot(test_spectrum);
m=0.406;b=336.64;L=b+m*(0:1:numel(test_spectrum)-1);
plot(L,test_spectrum);
for i=1:4
test=imread(['curc_',num2str(0+i),'.jpeg'])
test2=rgb2gray(im2double(test));
spectra(i,:)=sum(test2(1750:2500,1800:3000),1);
end
plot(L,spectra)
for i=2:4;absorbance(i-1,:)=-1*log10(spectra(i,:)./spectra(1,:));end
plot(L,absorbance)
set(gca,'fontsize',14);xlabel('wavelength(nm)');ylabel('absorbance(a.u)')
clear
test=imread('carrot_1.jpeg');
test2=rgb2gray(im2double(test));
image(test);
test_spectrum=sum(test2(1750:2500,1800:3000),1);
figure();plot(test_spectrum);
m=0.406;b=336.64;L=b+m*(0:1:numel(test_spectrum)-1);
plot(L,test_spectrum);
for i=1:4
test=imread(['curc_',num2str(0+i),'.jpeg'])
test2=rgb2gray(im2double(test));
spectra(i,:)=sum(test2(1750:2500,1800:3000),1);
end
plot(L,spectra)
for i=2:4;absorbance(i-1,:)=-1*log10(spectra(i,:)./spectra(1,:));end
plot(L,absorbance)
set(gca,'fontsize',14);xlabel('wavelength(nm)');ylabel('absorbance(a.u)')
0 Kommentare
Antworten (1)
Julius Muschaweck
am 8 Apr. 2021
It's hard to reproduce what you did without the jpeg files.
But, maybe hold on is what you need:
figure();
plot([1 2],[1 2]);
hold on;
plot([1 2],[2 1]);
gives you
0 Kommentare
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!