polyFit#

swordfish.function.polyFit()#

Return a vector indicating the least-squares fit polynomial coefficients in ascending powers for a polynomial p(X) of degree n that is a best fit (in a least-squares sense) for the data in Y.

Parameters:
  • X (Constant) – A numeric vector specifying the query points. The points in X correspond to the fitted function values contained in Y.

  • Y (Constant) – A numeric vector of the same length as X, which specifies the fitted values at query points. It must not contain null values.

  • n (Constant) – A non-negative scalar indicating the degree of polynomial fit.

  • mode (Constant) – A Boolean scalar indicating whether to return a dictionary of a vector. Defaults to 0, meaning to return a vector.