Skip to main content
Logo image

Section 10.3 Curve Fitting Examples

Let’s start again with our set of data values and take a look at interpolating polynomials of various degrees for these data values:
Linear least-squares fit:
p = polyfit(x,y,1)
Quadratic least-squares fit:
p = polyfit(x,y,2)
Cubic least-squares fit:
p = polyfit(x,y,3)
Quartic least-squares fit:
p = polyfit(x,y,4)
Septic or Heptic least-squares fit:
p = polyfit(x,y,7)
Nonic least-squares fit:
p = polyfit(x,y,9)
Zooming out to show you a bit more of this curve: