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 Comments

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);

Sign in to comment.

Answers (0)

Categories

Find more on Graph and Network Algorithms in Help Center and File Exchange

Asked:

on 19 Jul 2018

Edited:

on 19 Jul 2018

Community Treasure Hunt

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

Start Hunting!