The polyfit function creates a least-squares fit of the data to a polynomial, given the independent and dependent variable data, and the desired polynomial degree.
The polyval function uses the polynomial coefficients returned by polyfit, and the desired independent variable vector, and calculates the value of the fitted polynomial at the values of the independent variable supplied to it.
Best Answer