Peak analysis of spectrum

9 次查看(过去 30 天)
Nathan Kennedy
Nathan Kennedy 2017-4-5
Hi, I have an emission spectrum of experimental data (attached graph). I have overlaid one emission line which should match a peak from the spectrum. I have many emission lines to add.
Is there a method on MATLAB for finding a peak that is in a defined proximity of an overlaid emission line and once found, calculate the wavelength width of this peak.
Thanks

回答(2 个)

Star Strider
Star Strider 2017-4-5
Consider using the Signal Processing Toolbox findpeaks function to locate the peak amplitudes and frequencies.
  2 个评论
Nathan Kennedy
Nathan Kennedy 2017-4-6
Hi, I have used this but I need to insert a section of code that will be another filter for selection of peaks. The extra selection should look at whether the peak is within a specified wavelength range of one of the emission vertical lines.
spectrumdata =csvread('spectrum8bin.csv');
wavelength = spectrumdata(:, 1);
SFD = spectrumdata(:, 2);
[pks,locs,widths,proms] = findpeaks(SFD,wavelength,'Threshold',2,'MinPeakProminence',4)
[psor,lsor] = findpeaks(SFD,wavelength,'SortStr','descend','Threshold',2,'MinPeakProminence',4)
findpeaks(SFD,wavelength,'Threshold',2,'MinPeakProminence',4,'Annotate','extents')
text(lsor+.02,psor,num2str((1:numel(psor))'))
widths
For example, some of the vertical lines are at the following wavelengths
SVI1 = vline(937.06,'r','S-VI');
Lygamma2= vline(972.54,'r','Lygamma');
Star Strider
Star Strider 2017-4-6
If you have the ‘specified wavelengths’ as a vector, subtract the frequency (locations) vector returned by findpeaks from the reference vector to calculate the deviation (or preferably absolute deviation) and then use some threshold to determine if the deviations are appropriate. The vectors should be the same size. (Otherwise, you can use the bsxfun function with the @minus function, but that will necessarily be more difficult.)
I’m not certain what you want to do from your description, so that’s my best guess as to how to approach it.

请先登录,再进行评论。


Nathan Kennedy
Nathan Kennedy 2017-4-6
Hi, I have used this but I need to insert a section of code that will be another filter for selection of peaks. The extra selection should look at whether the peak is within a specified wavelength range of one of the emission vertical lines.
spectrumdata =csvread('spectrum8bin.csv');
wavelength = spectrumdata(:, 1);
SFD = spectrumdata(:, 2);
[pks,locs,widths,proms] = findpeaks(SFD,wavelength,'Threshold',2,'MinPeakProminence',4)
[psor,lsor] = findpeaks(SFD,wavelength,'SortStr','descend','Threshold',2,'MinPeakProminence',4)
findpeaks(SFD,wavelength,'Threshold',2,'MinPeakProminence',4,'Annotate','extents')
text(lsor+.02,psor,num2str((1:numel(psor))'))
widths
For example, some of the vertical lines are at the following wavelengths
SVI1 = vline(937.06,'r','S-VI');
Lygamma2= vline(972.54,'r','Lygamma');

Community Treasure Hunt

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

Start Hunting!

Translated by