exponential fit base 10
Ältere Kommentare anzeigen
hello, i want to fit a exponential function (base 10) to my data i tried use this code :
ft2 = fittype('a + b * 10^(-c*freq)','dependent',{'absol'},'independent',{'freq'},'coefficients',{'a','b','c'});
f2 = fit(freq,absol,ft2);
plot(f2,freq,absol);
but the fit I got was a const line. not a exponential one. any idea what my problem may be? thank.
Akzeptierte Antwort
Weitere Antworten (1)
Jos (10584)
am 6 Mär. 2018
Your plot command is incorrect, it seems (f2 is the fit result, not an x-value). So, try this:
plot(freq, f2(freq), 'r-')
3 Kommentare
sarel aharoni
am 6 Mär. 2018
Jos (10584)
am 6 Mär. 2018
What is the output of fit?
I also think you might want to add a dot before the power symbol in the formula (matrix power vs element-wise power):
a + b * 10 .^ (-c * freq)
sarel aharoni
am 6 Mär. 2018
Kategorien
Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!