Gaussian fiting
4 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
採用された回答
Andrew Newell
2011 年 4 月 4 日
1. Polyfit wouldn't make much sense because a Gaussian is not polynomial and would be badly approximated by polynomials.
2. The normalizer is irrelevant because you are multiplying it by some unknown. Also, since mu is the mean (and therefore determines the horizontal displacement), you could get rid of C. However, you need an extra pair of parentheses:
G = A * exp(-(1/2)*((X-mu)/sigma).^2);
Or you could get rid of mu and keep C:
G = A * exp(-(1/2)*(X/sigma).^2) + C;
Either way, you now only have 3 parameters to fit.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Polynomials についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!