So, this is driving me crazy and I don't understand why the results I get from the curve fitting toolbox is so unreasonable.
All I wanted to do is to fit a polynomial to my x and y (attached as a mat file).
I could get a good fit by using a polynomial of degree 6.
Now, as I tried to reproduce the nice figure cftool created using the coefficients it got me, it was very very far.
versus
, which is what I plotted with the provided coefficients. I used different ways to get the coefficients, too. From copying them from cftool to saving it to workspace and using a function or generating a code. All gave me something so off.
The results are so unreasoanable that when I tried a polynomial of degree 1 to fit this (p1(x) + p2) it gave me both p1 and p2 to be negative!! It is clear that whatever the fit is, p2 has to be positive.
I don't understand what I'm doing wrong. Will be very thankful if someone could help.
Best Answer