0
votes

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:

curve fitting 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.

1
You have a warning about the equation being badly conditioned, you might want to tick the "center and scale" option...Wolfie
I actually didn't know what that mean... I kind of new to Matlab and this community... I just started it like three days ago to do some graph (picture) to function converting... I currently using image processing to convert the image to a binary matrix so I can extract the graph line from the matrix and using some line of code to convert it's location in matrix to the actual x and y data from the graph, and the last part is using curve fitting to the data tp find the function of that graph... sorry if i you cant understand my explanation, english is not my native languageSayid Ibrahim
but if you understand, do you have any other method to achieve that same purpose? it doesn't have to be matlab, thank youSayid Ibrahim

1 Answers

1
votes

You can save your fit to the workspace from the "Fit" menu

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