
Fitting Gaussian Distribution to Data

j s s
Hi all,
I have a certain data set with two peaks, and I want to attempt to them to two Gaussian distributions with "new fit function," which is under curve fitting. I want to familiarize myself first with navigating new fit function, so I generated data with gnoise. I also want to add statistical noise to the data set by adding sqrt(n) to the data. Using new fit function, how do I come up with the coefficients and independent variables to custom fit a Gaussian distribution? I hope this makes sense.
Here's my code so far.
Function GaussTest() SetRandomSeed 1 Make/N=1000/O data1=sqrt(1000)+gnoise(1) Make/N=100/O Norm_Hist Histogram/P/B={0,1,100} data1, Norm_Hist end
You could use Multipeak Fit 2 to do the fitting- that gets around trying to build your own fitting function. See File->Example Experiments->Curve Fitting->Multi-peak fit 2 Demo.
You could base your fitting function on Igor's built-in functions gauss() or Gauss1D(). Here is one I built:
I used the Curve Fit dialog's New Fit Function button. To get the two temporary waves to pass to the Gauss1D function, you need to add lines above the template's f(xx) = line in the code editing box in the New Fit Function dialog.
March 25, 2019 at 02:15 pm - Permalink