What is formulae used to calculate gaussian fit coefficients by matlab ?
15 views (last 30 days)
Show older comments
Hi All,
I have two arrays
a = [ 1,2,3,4,5,6,7,8,9 ]; b = [ 1,2,3,4,5,4,3,2,1 ]; I do f = fit( a,b, 'gauss1' );
The result is f =
General model Gauss1:
f(x) = a1*exp(-((x-b1)/c1)^2)
Coefficients (with 95% confidence bounds):
a1 = 4.611 (4.29, 4.932)
b1 = 5 (4.819, 5.181)
c1 = 3.194 (2.916, 3.472)
I understand b1 is mean and it is calculated as b1 = (sum( a.*b))/sum( b) But I am not able to understand how the values of c1 and a1 are generated. The common practice of getting standard deviation for c1 doesn't work.
Can anyone please tell me how this is addressed in matlab , what concept is used to get these values for the corresponding gauss1 fit.
Regards Subhajit
3 Comments
LR
on 26 Sep 2020
I've been struggling with this too, and I still don't quite understand it. I've been trying to calculate the mean and standard deviation of a fitted Gaussian using the same formulae as above, but it just doesn't add up. In this case you can see that a1 gives sigma = 0.0865 and c1 gives sigma = 2.2585. Do you guys understand why this may be the case?
Answers (0)
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!