Back to Polynomial Functions
polyfit
Least-squares power series fit
Syntax
c = polyfit(x, y, deg)
Description
Fits a power series polynomial of the given degree to data using least squares.
Parameters
| Name | Description |
|---|---|
| x | x values |
| y | y values |
| deg | Degree of fitting polynomial |
Returns
Coefficient array in ascending order
Examples
Try It
>> polyfit([0 1 2 3], [0 1 4 9], 2)