ezfit using a function

2 visualizzazioni (ultimi 30 giorni)
aneps il 8 Lug 2022
Modificato: Walter Roberson il 13 Lug 2022
I use ezfit to fit a gaussian in my data. It is straight forward as it is in the ezfit examples:
f1 = ezfit(x,counts,'gauss');
I want to fit my own function. So before doing that, I attempted using the equation of gaussian, exaclty the same equation in the ezfit documentation to fit the data ( http://www.fast.u-psud.fr/ezyfit/html/ezfit.html ). I am doing this to check if I am doing any mistakes. I did as follows
f1 = ezfit(x,counts,'a*exp(-(x-x0)^2/(2*s^2))');
This time it doesn't fit! Could you please tell me what is wrong in it?
  2 Commenti
aneps il 13 Lug 2022
Still it doesn't fit! I used f1 = ezfit(x,counts,'y = a*exp(-(x-x0)^2/(2*s^2))');, it doesn;t work. But if I use f1 = ezfit(x,counts,'gauss'); it do the job! Don't understand what cause this difference. Data attached.. Here, first I plot the histogram of column 9. Then I do the curve fit on the histogram.

Accedi per commentare.

Risposte (0)




Community Treasure Hunt

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

Start Hunting!

Translated by