Hello,
I have (X,Y) data and i want to fit this data with a Gaussian. Basically i use 'lsqnonlin' which works fine (if the initial solution X0 is not too bad).
I just have two questions because i don't have a lot of experience with Matlab:
1/ lsqnonlin seems to be an appropriate method (Gaussian = non linear (mu,sigma)) but i find a tool in mathwork which use polyfit ? Do you think Polyfit or other methods would be better than lsqnonlin (regarding to the stability of the final solution and the importance of the initial solution).
2/ I use the folowing definition for Gaussian :
G = A * 1/(sigma*sqrt(2*pi)) * exp(-(1/2)*(X-mu/sigma).^2) + C;
A,mu sigma and C are the variable to estimate.
This allow me to obtain sigma directly. Do you think it's the best way to "express" the Gaussian ?
Thank you very much for your help
Best Answer