Find the centroid of spectra, plot and analyze!

1 view (last 30 days)
I have few spectra from Fiber Bragg Gratings, it is text file having 3 columns (we will consider only 1st and 3rd column, which are wavelength and power values respectively). See the attached program and files I am using currently to open spectra.
I am using the equation [ Centroid = ∑(wavelength.*power) / ∑(power) ] to find centroid of spectra.
Question-1) As shown in attached image, when I plot multiple spectra, the centroid values are outside the spectra. Are those values precise?
Question-2) If not, what is the solution and is it necessary that centroid value should come inside the spectra somewhere?
Question-3) If I get the correct values of centroid for multiple files (let say I have 5 spectra and 5 centroid value), how I can make a matrix which can find the difference of location from one centroid to another, with respect to x and y axis? for instance, 2nd centroid has 2nm shift on x axis and 5 dB shift on y axis compare to 1st centroid.
Note: Attached centroid.txt file,one can run in matlab and can use attached other two text files as sample spectra.

Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!