MathRoutinesPolynomialRegression Method (Double, Double, Double, Int32, Double) |
LightningChart .NET Help
Calculate polymial line fit. Calculates polynomial factors, and uses these factors to solve Y values based on given X value array.
Namespace:
Arction.WinForms.Charting
Assembly:
Arction.WinForms.Charting.LightningChart (in Arction.WinForms.Charting.LightningChart.dll) Version: 10.3.1
Syntaxpublic static double[] PolynomialRegression(
double[] xInFactorization,
double[] yInFactorization,
double[] xValuesToFit,
int order,
out double[] factors
)
Public Shared Function PolynomialRegression (
xInFactorization As Double(),
yInFactorization As Double(),
xValuesToFit As Double(),
order As Integer,
<OutAttribute> ByRef factors As Double()
) As Double()
public:
static array<double>^ PolynomialRegression(
array<double>^ xInFactorization,
array<double>^ yInFactorization,
array<double>^ xValuesToFit,
int order,
[OutAttribute] array<double>^% factors
)
Parameters
- xInFactorization
- Type: SystemDouble
X values that are used to calculate the factors. This is the point set where the regression line is fitted to. - yInFactorization
- Type: SystemDouble
Y values that are used to calculate the factors. Length must be equal to xInFactorization length. - xValuesToFit
- Type: SystemDouble
X values whose Y values are to be solved, using the factors - order
- Type: SystemInt32
Order of polynomial. Usually more than 3 shouldn't be used - factors
- Type: SystemDouble
Polynomial result factors, length = order+1. For example, when having order 2, you can plot line with equation: Y = factors[0] + factors[1]*X + factors[2]*X^2
Return Value
Type:
DoubleFitted Y values, the length equals to xValuesToFit length. Returns null if failed.
See Also