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

John D'Errico
John D'Errico 2022년 5월 31일
편집: John D'Errico 2022년 5월 31일
You have not shown what you actually did, only some apparently screwy results. You have not provided the actual data you started with, only what may be a picture of it. Is there a way to offer good help? It looks like you tried to fit a quadratic polynomial to the data in the first figure. Of course that would produce crap. Would you expect otherwise? Such a quadratic polynomial could not possibly look any different.
So slow down. State what you actually need to do. Provide some data, not just pictures of data. Tell us what model you want to use.
If you append some data, then do so, attached to a comment on your question, or by editing your question, not as an answer.
Researcher
Researcher 2022년 6월 1일
편집: Researcher 2022년 6월 1일
I edited my question with the data and the tool I used. @John D'Errico
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.
Researcher
Researcher 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.

댓글을 달려면 로그인하십시오.

 채택된 답변

Researcher
Researcher 2022년 6월 1일
편집: Researcher 2025년 1월 9일

0 개 추천

Use the fit() function from the curve fitting toolbox:
f = fit(x,y,'gauss1')
y = f(x)

댓글 수: 1

Matt J
Matt J 2022년 6월 1일
Why gauss2, rahter than gauss1? Your plots show only a single lobe.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Image Analyst
Image Analyst 2022년 6월 1일
편집: Image Analyst 2022년 6월 1일

0 개 추천

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

Researcher
Researcher 2022년 6월 1일
Is this also true if my goal is to ultimately generate a gaussian Point Spread Function in the end? I'm simply following this script here (which uses a Gaussian fit) to find the MTF, then I am generating the PSF by taking the ifft of the 2D MTF (which I find by rotating the 1D MTF about its vertical axis).
Besides the sinc vs. gaussian issue, is this logic sound for finding the PSF?
You're not getting the PSF. I don't see any code for that.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

제품

릴리스

R2021b

질문:

2022년 5월 31일

편집:

2025년 1월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by