Azzera filtri
Azzera filtri

Exponential Curve fit data a & b

1 visualizzazione (ultimi 30 giorni)
Martha
Martha il 19 Nov 2014
Risposto: Martha il 19 Nov 2014
Hi, I'm trying to run a script automatically, and at some point I need to plot an exponential curve into a set of x and y data. I can do that in the 'Curve Fitting' APP and take the values of a and b from there. But I need to do it automatically like a process inside the script. I try this:
exp_curve=fit(x,y,'exp1');
And it returns to me the results in the Command Window as:
General model Exp1:
f2(x) = a*exp(b*x)
Coefficients (with 95% confidence bounds):
a = 584.6 (532.8, 636.4)
b = 0.004903 (0.004306, 0.005499)
However, it just print this on the Command Window, but I dont know how to take the values of a and b directly from the new variable created, because the variable 'exp_curve' doesnt return to me directly the results, and the type of variable is different is 1x1 cfit.
I will appreciate some help, Thank you, Martha

Risposta accettata

Torsten
Torsten il 19 Nov 2014
a=exp_curve.a;
b=exp_curve.b;
should give you the values of the fitting parameters.
Best wishes
Torsten.

Più risposte (2)

Andrei Bobrov
Andrei Bobrov il 19 Nov 2014
use function coeffvalues

Martha
Martha il 19 Nov 2014
Thank you both for the answers, Martha

Community Treasure Hunt

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

Start Hunting!

Translated by