MATLAB Answers

Extraction of values from a cfit object

216 views (last 30 days)
Antonio on 3 Apr 2013
Answered: Igor Varfolomeev on 25 Nov 2018
Dear, I used the fit function to interpolate two set of experimental data (X,Y) with a function fun previously defined with fittype. Fun contains 3 constant A, k1 and k2. After i estimates three constants with by using fit as follow: [fitresult, gof]=fit(X,Y,fun) I obitaining an object containing the fit the followin results: fitresult =
General model:
fitresult(x) = 562.16*exp(-k2*x)+(k1*A/(k2-k1))*(exp(-k1*x)-exp(-k2*x))
Coefficients (with 95% confidence bounds):
A = 1202 (481.5, 1921)
k1 = 5 (-119, 129)
k2 = 0.2374 (-0.1202, 0.595)
This is a cfit object. My question is: How can extract the values of A, k1 and k2 from the above object. I need to use the estimated value for different steps of my script.

  1 Comment

Yougu on 11 Apr 2013
use: fitresult.A; fitresult.k1; fitresult.k2;
is it what you need?

Sign in to comment.

Answers (1)

Igor Varfolomeev
Igor Varfolomeev on 25 Nov 2018
The answer by @Yougu
fitresult.A; fitresult.k1; fitresult.k2;
is correct.
For me it was a bit counter-intuitive at first as well :).


Sign in to comment.

Sign in to answer this question.