Which Gaussian fitting tool should I use?

4 次查看(过去 30 天)
I used a gaussian fitting function that generated this result. Surely this graph can look more gaussian rather than parabolic?
I also tried using fit() from the curve fitting toolbox which gave me a straight line. What could be going wrong?
Here is the data:
% x
Columns 1 through 8
-16 -15 -14 -13 -12 -11 -10 -9
Columns 9 through 16
-8 -7 -6 -5 -4 -3 -2 -1
Columns 17 through 24
0 1 2 3 4 5 6 7
Columns 25 through 32
8 9 10 11 12 13 14 15
% y
Columns 1 through 8
79 85 87 84 77 92 84 88
Columns 9 through 16
93 88 90 98 99 133 164 183
Columns 17 through 24
180 134 107 92 86 85 85 79
Columns 25 through 32
94 85 90 82 93 83 102 8
  4 个评论
Matt J
Matt J 2022-6-1
@Asser Abdelgawad You have provided the data, but in a form that is not easily retrieved or copy-pasted. Ideally, you would attach the x,y data in a .mat file.
Asser Abdelgawad
Asser Abdelgawad 2022-6-1
Hello, I answered my own question by using the fit() function from the Curve Fitting Toolbox. Thanks for your investment @Matt J and @John D'Errico.

请先登录,再进行评论。

采纳的回答

Asser Abdelgawad
Asser Abdelgawad 2022-6-1
Use the fit() function from the curve fitting toolbox:
f = fit(x,y,'gauss2')
y = f(x)

更多回答(2 个)

Matt J
Matt J 2022-5-31
Personally, I'm a fan of this Gaussian fitting routine:

Image Analyst
Image Analyst 2022-6-1
编辑:Image Analyst 2022-6-1
Why are you trying to fit a Gaussian to the Line Spread Function? LSFs are commonly sinc functions - yours even looks like one. Seems like you should use fminsearch to find the best fit sinc function.
  3 个评论

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by