Reputation: 3
I have a question about curve fitting coefficient in matlab,
how can I get the exact value stored in p1, p2, p3, etc, as seen in the Matlab Curve Fitting Toolbox Interface:
I'm currently working on making the f(x) function from some known data and using a big exponential number type produced a lot of error to the function because it means the number rounded heavily.
Upvotes: 0
Views: 364
Reputation: 30047
You can save your fit to the workspace from the "Fit" menu
With the default export options, you'll get a variable called fittedmodel
which has the properties p1
, p2
, p3
, ..., which are the values of your coefficients
>> x = linspace(0,10,100);
>> y = rand(size(x))*5 + x.^2;
>> % Use curve fitting app and export 'fittedmodel'
>> fittedmodel.p1
1.034293219979936
>> fittedmodel.p2
-0.308627984704966
>> fittedmodel.p3
2.786188360368544
Upvotes: 1