MATLAB Answers

Antonio
1

Extraction of values from a cfit object

Asked by Antonio
on 3 Apr 2013
Latest activity Answered by 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.
Thaks
Antonio

  1 Comment

use: fitresult.A; fitresult.k1; fitresult.k2;
is it what you need?

Sign in to comment.

1 Answer

Answer by 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 :).

  0 Comments

Sign in to comment.