2017-09-15 回答
最简单的多项式拟合
p = polyfit(x,y,n) finds the coefficients of a polynomial p(x) of degree n that fits the data y best in a least-squares sense. p is a row vector of length n+1 containing the polynomial coefficients in descending powers, p(1)*x^n + p(2)*x^(n-1) +...+ p(n)*x + p(n+1).
三次样条插值
pp = spline(x,y) returns the piecewise polynomial form of the cubic spline interpolant for later use with ppval and the spline utility unmkpp. x must be a vector. y can be a scalar, a vector, or an array of any dimension. if y is an array that is not a vector, the size of y must have the form [d1,d2,...,dk,n], where n is the length of x. the interpolation is performed for each d1-by-d2-by-...-dk value in y.
yy = spline(x,y,xx) is the same as yy = ppval(spline(x,y),xx), thus providing, in yy, the values of the interpolant at xx. xx can be a scalar, a vector, or a multidimensio