Table of Contents

Class PolynomialFitter

Namespace
SignalSharp.Utilities
Assembly
SignalSharp.dll

Provides methods for polynomial fitting and evaluation.

public static class PolynomialFitter
Inheritance
PolynomialFitter
Inherited Members

Methods

EvaluatePolynomial(double[], double)

Evaluates a polynomial at a given x-value using the provided coefficients.

public static double EvaluatePolynomial(double[] coefficients, double x)

Parameters

coefficients double[]

The coefficients of the polynomial, from lowest to highest order.

x double

The x-value at which to evaluate the polynomial.

Returns

double

The y-value of the polynomial at the given x-value.

FitPolynomial(double[], double[], int)

Fits a polynomial of specified order to the given data points using the least squares method.

public static double[] FitPolynomial(double[] x, double[] y, int order)

Parameters

x double[]

The x-coordinates of the data points.

y double[]

The y-coordinates of the data points.

order int

The order of the polynomial to fit.

Returns

double[]

An array of coefficients for the fitted polynomial, from lowest to highest order.

Exceptions

ArgumentException

Thrown when:

  • The input arrays have different lengths.
  • The polynomial order is negative.
  • The number of data points is less than or equal to the polynomial order.