![]() ![]() I found that the MATLAB "fit" function was slow, and used "lsqcurvefit" with an inline Gaussian function. Which you can cross-check with x(3) = R (there should only be small differences). Which you then have to reverse-engineer to find the mean μ and the standard-deviation σ: mu = -x(2)/x(1)/2 The vector x you found this way will equal x = Now, solve for the linear system Ax=b with (these are Matlab statements): % design matrix for least squares fitĪ = If you know for sure your data y will be well-described by a Gaussian, and is reasonably well-distributed over your entire x-range, you can linearize the problem (these are equations, not statements): y = 1/(σ You'll find ready-made implementations here, or here, or here for 2D, or here (if you have the statistics toolbox) (have you heard of Google? :)Īnyway, there might be a simpler solution. Fitting a single 1D Gaussian directly is a non-linear fitting problem. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |