67 visualizzazioni (ultimi 30 giorni)
12ar.af il 27 Set 2011
Commentato: Gabriela il 28 Set 2023
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...
  2 Commenti
12ar.af il 30 Set 2011
can i use spline?

Accedi per commentare.

Risposte (2)

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
  2 Commenti
Gabriela il 28 Set 2023
Hello! Thanks you this is so helpful! Do you know how I can get the equation to remain on the plot? Once I switch to different data or if i close the fitting toolbox it dissapears.

Accedi per commentare.

Walter Roberson
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.


Scopri di più su Interpolation in Help Center e File Exchange


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by