Why is the POLYFIT function in MATLAB unable to find a fit over my data values for 3rd and 4th order polynomial.
1 view (last 30 days)
Show older comments
with ref. to earlier posts : http://www.mathworks.com/matlabcentral/answers/98325-why-is-the-polyfit-function-in-matlab-unable-to-find-a-fit-over-my-data-values
I am using the POLYFIT function to fit a 3rd and 4th order polynomial over my data values
I get following warning message
Warning: Polynomial is badly conditioned. Add points with distinct X values, reduce the degree of the polynomial, or try centering and scaling as described in HELP POLYFIT.
My query is what would be the transformation equations for the 3rd and 4th order polynomial equations, wherein i had to extract [A,B,C,D] and [A,B,C,D,E], respectively.
Hope for the earliest reply.
0 Comments
Answers (2)
Image Analyst
on 27 Oct 2014
Try using all the arguments, like S and mu, and make sure you have at least 5 unique x points.
Jan
on 27 Oct 2014
Look into the code of polyfit and polyval. The scaling is implemented there. But you do not want to get the values of the fitted polynomial, but the coefficients. Anyway, if you have the formula for teh scaling of the x values, insert it to the polynomial equation, reorder the terms and you get the modified coefficients directly. This is very basic maths with plus, minus, division and multiplication. You can use the example the Mathworks team has posted to control, how this works for the polynomials of order 2. Exanding this to higher orders is not hard.
Please try this at least.
0 Comments
See Also
Categories
Find more on Polynomials in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!