How do you find the Full Width Half Maximum from this graph?

This is a section of my code that graphs the data from an imported wdf file (picture provided). I need help writing a code that will produce a FWHM graph from the curve seen in the picture. Can you help me please as I am new to Matlab and have no idea what to put?
spec1 = SPECTRA(4,:);
Eg = (XLIST<1150 & XLIST > 950);
Eg=+Eg;
plot(XLIST,spec1)

2 commentaires

Aquatris
Aquatris le 19 Juil 2018
Modifié(e) : Aquatris le 19 Juil 2018
see here or many other more related questions in this website.
I changed my code following the one from the link. I ended up with this graph shown below. How would I go about fixing the graph? The blue function should be centered and the red lines providing the FWHM?
spec1 = SPECTRA(4,:);
Eg = (XLIST<1150 & XLIST > 950);
Eg=+Eg;
plot(XLIST,spec1)
grid on;
oneProfile = spec1;
maxValue = max(oneProfile);
aboveHalfMax = oneProfile>maxValue/2;
firstIndex = find(aboveHalfMax,1,'first');
lastIndex = find(aboveHalfMax,1,'last');
hold on;
line([firstIndex firstIndex],[0 maxValue/2],'Color','r','LineWidth',2);
line([lastIndex lastIndex],[0 maxValue/2],'Color','r','LineWidth',2);
line([firstIndex lastIndex],[maxValue/2 maxValue/2],'Color','r','LineWidth',2);

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Graph and Network Algorithms dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by