Exponential Curve fit data a & b

1 次查看(过去 30 天)
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

采纳的回答

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

更多回答(2 个)

Andrei Bobrov
Andrei Bobrov 2014-11-19
use function coeffvalues

Martha
Martha 2014-11-19
Thank you both for the answers, Martha

类别

Help CenterFile Exchange 中查找有关 Fit Postprocessing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by