Importing 3 spectrum data, plot representative spectrum for each sample all in same figure
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Julius Muschaweck
2021년 4월 8일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!