LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to fit multiple guassian peaks ?

Solved!
Go to solution

Hi,

I have a  two column data set (x,y) that contain large number of Gaussian peaks ( several hundredes infact). You can think of it more like a wavelength spectrum. The number of spectral peaks is not known exactly. There is no problem in detecting the peaks as they are of same amplitude. Eventually I want to fit a Gaussian funtion to each of these spectral  peak and obtain the the parameters  such as  amplitude, line-center and sigma.  This seems a somewhat tricky in LabVIEW. There is an example ( Sum of 3 Gaussian with offset) that comes bundled with LabVIEW. This example VI however uses a static refrence to a model function which is sum of three gaussian curves.  This works well for few number of peaks in the data. If we have large number of peaks ( e.g spectroscopy data) then creating such a model function for a large number of peaks is nealy  impractical.  Is there a  better way to handle  such peak-fitting problems in LabVIEW? Would greatly appreciate if someone could point out any existing  LV code/library function.

Regards,

RK

0 Kudos
Message 1 of 5
(6,426 Views)

Well, all you need to do is make the model function scaleable so it generates an arbitrary number of peaks, based on the number of fitting paramters given. (See e.g. example #2 here)

 

You could get initial estimated from the Peak detector.

 

Can you show us a typical spectrum?

Are all widths similar?

Message 2 of 5
(6,410 Views)
Solution
Accepted by topic author banyal

I looked in to this problem a few years ago.  The problem I encountered was that for each peak in my signal, I was basically trying to fit 4 parameters... so 10 peaks = 40 individual parameters that had to be approximated for the fitting function to even be close.

 

I ended up doing exactly what altenback said:  I used the built in peak detect, "guessed" the edges of the peak, split the array, and then did a sum of 2 gaussian + background fit for that split array. 

0 Kudos
Message 3 of 5
(6,390 Views)

Greetings,

 

I was perusing the message boards, specifically the discussion on fitting multiple Gaussian peaks within a single spectrum, and I came across the response you posted. Just wondering if you still have the VI for such a functionality and if you would be willing to share it.

 

Best,

 

Stuart

0 Kudos
Message 5 of 5
(5,160 Views)