Gaussian Curve-fitting algorithm
11,592
- Calculate the mean of the data:
mu = 1/N Sum(xi)
- Calculate the dispersion of the data:
sigma = sqrt(1/(N-1) Sum(xi-mu))
- Fill in the parameters:
gauss = 1/(sigma*sqrt(2pi)))*exp(-1/2*((x-mu)/sigma)^2)
I don't see any need for fitting the beast with the easy math involved.
Related videos on Youtube
Author by
user1425322
Updated on June 04, 2022Comments
-
user1425322 almost 2 years
Folks,i have been trying to obtain a Gaussian fit for some data sets which somehow look like a distorted normal distribution.I have been using software to do that. I wonder if i can apply an iterative algorithm to convert these data sets to a Gaussian fitted curve,the standard deviation and mean of the original curve being the inputs.? Any ideas?
-
huon almost 12 yearsYou will probably get more informative answers at stats.stackexchange.com :)
-
Zorg about 5 yearsI have a similar problem. I have found this. Guo, Hongwei. (2011). A Simple Algorithm for Fitting a Gaussian Function [DSP Tips and Tricks]. IEEE Signal Processing Magazine - IEEE SIGNAL PROCESS MAG. 28. 134-137. 10.1109/MSP.2011.941846. It is a very easy algorithm. The publication is open access.
-
-
ev-br almost 12 yearsThis sure works in the majority of situations, but not all. For example, if the input data are integers and the distribution is very narrow, the estimator for the dispersion should be different.
-
Mathias almost 12 yearsI believe the correct estimator for the dispersion is sqrt(1/(N-1) Sum(xi-mu)). The sample variance (the one you propose) has a slight bias. en.wikipedia.org/wiki/…
-
rubenvb almost 12 years@Mathias "correct" is a misleading word here, but I guess you're right. It's certainly "better" in non-theoretical contexts.
-
user1425322 almost 12 years@rubenvb thanks a lot..The algorithm seems to produce neat results.But I just want to know if i get into the case which Zhenya pointed out.My guess is that it should work fairly fine.