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 Kommentare

Aquatris
Aquatris am 19 Jul. 2018
Bearbeitet: Aquatris am 19 Jul. 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);

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Graph and Network Algorithms finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 19 Jul. 2018

Bearbeitet:

am 19 Jul. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by