From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Gaussian fitting

Hi

 

I am running an experiement where I calculate the power spectrum of a signal and then fit a Gaussian to the Power Spectrum in order to measure a peak.

When I use labview to fit to my data, I get a peak with the correct centre, but an overly large standard deviation.

 

If I analyse the same data in Origin Lab, I am able to fit a very good Gaussian with low R^2 value. 

 

Attached is an exmple of my data. 

 

I would appreciate any suggestions as to how to get labview to perform a better fit.

0 Kudos
Message 1 of 6
(2,947 Views)

We cannot help if you do not provide the Labview code you used to make the fit. The data would be helpful as well. 

Marc Dubois
0 Kudos
Message 2 of 6
(2,943 Views)

Seems you are using Gaussian Peak Fit. If you don't wire the parameter bounds input, the offset is held fixed at zero by default (upper and lower bound=0, see the help). Seems to be happening in your case.

 

Fixes:

Wire the parameter bounds input (and at least make the offset to also be -inf..+inf).

0 Kudos
Message 3 of 6
(2,924 Views)

Hi,

 

Sorry, I thought I had added the code as well as my sample graph. 

 

Here is the code attached. 

0 Kudos
Message 4 of 6
(2,866 Views)

AlexMalm wrote:

Here is the code attached. 


We are missing a subVI.

 

Anyway, my guess was right. Why in the world would you use an inner subVI of the plain Gaussian Fit tool from the palette?? As you can easily tell, the one you are using cannot fit for an offset, but you data clearly shows a baseline that is not zero!

 

Use the real Gaussian Fit from the fitting palette and follow my recommendations in my earlier post. Simple as that! 😄

0 Kudos
Message 5 of 6
(2,852 Views)
Ah great thank you very much.
I've been middling around with some code written by someone else and working through things that could be made better etc.

Everything is working as desired
🙂
0 Kudos
Message 6 of 6
(2,804 Views)