gaussfit - optimal gauss curve through given data set
The data set {x(k),y(k)} should be approximated by an optimal Gauss curve of the form y=k0*exp(-(x-µ)^2 / 2*s^2. The quadratic deviations are optimized. Base of optimization is the equation exp(b2*x^2 + b1*x + b0).
CC represents the approximation quality 0<=CC<=1, the matrix Q contains in the 1st row the coefficients b2,b1,b0 and in the 2nd row the parameters. k0, µ, Sigma of the optimal gauss curve. Only data points with y>0 are used for approximation !
x=rand(1,40,'normal'); mueh=1.2; sgma=1.8; y=exp( -((x-mueh) .^2) ./(2 .*(sgma^2))) ./sqrt(2 .*(sgma^2)); [Q,CC]=gaussfit(x,y);
multireg ,