Matlab usage of the function fitnlm

957 Views Asked by At

I am using the function fitnlm :

f= @(a,x)(a(1)*log(x+a(2))); mod= NonLinearModel.fit(A,B,f,[3,1])

for some data points (A,B)).

The output is
enter image description here

I am having a problem how to get separately the values of a(1) and a(2) to use them in an internal matlab function. Does anay one know how can I get them ?

Thank you for your help.

1

There are 1 best solutions below

0
On BEST ANSWER

From the MATLAB documentation:

"Coefficient values, stored as a table. Coefficients has one row for each coefficient and the following columns" (as in the output of your model). "To obtain any of these columns as a vector, index into the property using dot notation."

Hence, in your example, the coefficients would be found in:

a = mod.Coefficients.Estimate