Curve Fitting
A data set on a known discrete point, known as a function value on a point set, constructs an analytic function (a graph of a curve) so as to be as close to a given value as possible at the original discrete point, a process known as curve fitting. The most commonly used curve fitting method is the least squares method, which is to find the function to make the smallest.
matlab function:p=polyfit (x,y,n)
[p,s]= polyfit (X,y,n)
Description:x, y is a data point, n is a polynomial order, and p is a polynomial coefficient vector p with power from high to low. The x must be monotonous. The matrix S is used to generate an error estimate for the predicted value. (see next function Polyval)
Polynomial-curve evaluation function: Polyval ()
Call Format: Y=polyval (p,x)
[Y,delta]=polyval (p,x,s)
Description:y=polyval (p,x) Returns the value of the polynomial corresponding to the argument x at the given coefficient p.
[Y,delta]=polyval (P,x,s) uses the Polyfit function's option output s to derive the error estimate y DELTA. It assumes that the error of the Polyfit function data input is independent and normal, and the variance is constant. The Y delta will contain at least 50% of the predicted values.