67 visualizzazioni (ultimi 30 giorni)
Hi guys, i have a question on polyfit. i have a set of data from a profile a picture, so know i want to use polyfit from 3rd degree to tenth degree to find which degree best fits the data so that it looks similar to the picture. can somebody help me pliz...
UJJWAL il 27 Set 2011
Kindly go to MATLAB and open the curve fitting toolbox. there select the data you want to fit and then clicking on the fitting button select a polynomial function and click on apply to fit the data Hope it helps. For details mail back
HAPPY TO HELP
Walter Roberson il 30 Set 2011
Sure you can use spline, but you specifically asked about polynomial fitting over the whole data (which is what polyfit does). Spline is defined through piecewise polynomials -- a different polynomial is used at every original point. Splines are pleasing to the eye, but useless at fitting a single function to the entire set of data, and seldom useful at extrapolating to points to the left or right of the given dataset.
There are an infinite number of different possible functions that precisely fit any finite set of data. That is infinite as in "uncountably large number", not just as an exaggeration for "a very large but fundamentally computable number". And if you say that there might be measurement error in the data such as from being limited to 53 bits of precision, then the only reason you do not have "more" polynomials to content with is that infinity times billions is still infinity.
Fundamentally fitting any particular function form (such as a polynomial) to a finite set of data is a more or less worthless thing to do unless you have prior knowledge that the data was generated by a process that has the characteristics of that function form. You have a better chance of picking the winning numbers in a major lottery than you have of picking the right function form for data created by an unknown process.