Xenomai
3.1
|
Functions | |
int | a4l_math_polyfit (unsigned r_dim, double *r, double orig, const unsigned dim, double *x, double *y) |
Calculate the polynomial fit. More... | |
void | a4l_math_mean (double *pmean, double *val, unsigned nr) |
Calculate the aritmetic mean of an array of values. More... | |
void | a4l_math_stddev (double *pstddev, double mean, double *val, unsigned nr) |
Calculate the standard deviation of an array of values. More... | |
void | a4l_math_stddev_of_mean (double *pstddevm, double mean, double *val, unsigned nr) |
Calculate the standard deviation of the mean. More... | |
void a4l_math_mean | ( | double * | pmean, |
double * | val, | ||
unsigned | nr | ||
) |
Calculate the aritmetic mean of an array of values.
[out] | pmean | Pointer to the resulting value |
[in] | val | Array of input values |
[in] | nr | Number of array elements |
int a4l_math_polyfit | ( | unsigned | r_dim, |
double * | r, | ||
double | orig, | ||
const unsigned | dim, | ||
double * | x, | ||
double * | y | ||
) |
Calculate the polynomial fit.
[in] | r_dim | Number of elements of the resulting polynomial |
[out] | r | Polynomial |
[in] | orig | |
[in] | dim | Number of elements in the polynomials |
[in] | x | Polynomial |
[in] | y | Polynomial |
Operation:
We are looking for Res such that A.Res = Y, with A the Vandermonde matrix made from the X vector.
Using the least square method, this means finding Res such that: A^t.A.Res = A^tY
If we write A = Q.R with Q^t.Q = 1, and R non singular, this can be reduced to: R.Res = Q^t.Y
mat_qr() gives us R and Q^t.Y from A and Y
We can then obtain Res by back substitution using mat_upper_triangular_backsub() with R upper triangular.
void a4l_math_stddev | ( | double * | pstddev, |
double | mean, | ||
double * | val, | ||
unsigned | nr | ||
) |
Calculate the standard deviation of an array of values.
[out] | pstddev | Pointer to the resulting value |
[in] | mean | Mean value |
[in] | val | Array of input values |
[in] | nr | Number of array elements |
Referenced by a4l_math_stddev_of_mean().
void a4l_math_stddev_of_mean | ( | double * | pstddevm, |
double | mean, | ||
double * | val, | ||
unsigned | nr | ||
) |
Calculate the standard deviation of the mean.
[out] | pstddevm | Pointer to the resulting value |
[in] | mean | Mean value |
[in] | val | Array of input values |
[in] | nr | Number of array elements |
References a4l_math_stddev().