LSQPolyCoef('X','Y','Degree','PolynomialType'=0)
Arguments
|
'X' |
X-coordinates (sampling points) that define the interpolation polynomial |
|
'Y' |
Y-coordinates that define the interpolation polynomial |
|
'Degree' |
Polynomial degree (0 = average, 1 = linear, 2 = square, 3 = cubic, etc.) |
|
'PolynomialType' |
Defines the base polynomials to use; 0 = Lagrange (default), 1 = Chebyshev I, 2 = Chebyshev II, 3 = Legendre |
Description
This function calculates the coefficient of an interpolation polynomial of the degree 'Degree' for value pairs 'X' and 'Y' according to the least squares method.
The result of the function is a vector (multidimensional signal, array) containing the coefficients. The array field with the index 0 contains the constant share or offset of the polynomial. The coefficients are written in array fields with ascending index according to their ascending degrees.
The function Polynomial can evaluate the polynomial.
With the optional parameter 'PolynomialType', you can use different base polynomials. The function supports the types Lagrange (default), Chebyshev I, Chebyshev II and Legendre.
Example
A quadratic approximation yields a polynomial of the form y = ax² + bx + c, i.e. the result is a vector with a total of 3 coefficients.
In principle, the function is based on an X-Y relationship, i.e. the operands X and Y can also be two different signals. If you want to calculate only one regression curve for a signal over time, the time values also have to be in the form of a signal, e.g. using Xvalues([signal]). You can use this time signal, whose Y-values are identical to the time along the X-axis, as operand 'X' in the LSQPolyCoef function.