MATLAB Answers

Finding the vertical offset of a gaussian fit

조회 수: 21(최근 30일)
Ahmed Abdulla
Ahmed Abdulla 2021년 7월 28일
댓글: Adam Danz 2021년 7월 29일
I apologize for posting this question again, as I believe I miss presented my question earlier.
I have the following data points as shown in the picture, and I am in the quest to obtain the vertical offset (v0) for the best gaussian fit to my data point. Equation for gaussian fit: gaus = amp*exp(-(((x-mu).^2)/(2*sig.^2)))+ v0.
I currently have the datasets x and y and I am stuck at that, any help is appreciated and sorry for posting this again
  댓글 수: 3
Adam Danz
Adam Danz 2021년 7월 29일
Also, the previous answer you accepted and then unaccepted also includes a vertical offset term and even lists the fit parameter values in the axes title.
You also copied the guassian equation from the previous answer into your current question above. I don't see how this question differs from the previous question.

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

채택된 답변

Matt J
Matt J 2021년 7월 28일
편집: Matt J 2021년 7월 28일
This File Exchange routine does gaussian+constant fitting:
y=amp*exp(-(((x-mu).^2)/(2*sig.^2)))+ v0;
Local minimum possible. lsqcurvefit stopped because the final change in the sum of squares relative to its initial value is less than the value of the function tolerance.
[v0,amp,mu,var]=p{:}, sig=sqrt(var)
v0 = 1.6697
amp = 4.0421
mu = 4.9868
var = 5.4130
sig = 2.3266
  댓글 수: 1
Ahmed Abdulla
Ahmed Abdulla 2021년 7월 29일
Thank you very much this is perfect :)

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

추가 답변(0개)




Community Treasure Hunt

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

Start Hunting!

Translated by