/Users/bernard/b20/bsoft/include/matrix_linear.h(3)

NAME
/Users/bernard/b20/bsoft/include/matrix_linear.h - Header file for matrix functions.

SYNOPSIS

#include 'Matrix.h'

  Functions
double linear_least_squares (int n1, int n2, double *x, double *y, double &a, double &b)
Does a linear least squares fit between two vectors.
double fit_polynomial (int n, double *x, double *y, int order, double *coeff)
Fits a data set to a polynomial function.
double fit_polynomial (int n, vector< double > &x, vector< double > &y, int order, vector< double > &coeff)
Fits a data set to a polynomial function.
Vector3< double > fit_plane (Matrix a, vector< double > b)
Solves for fitting a plane through a model.

Detailed Description

Header file for matrix functions.

Author:
    Bernard Heymann

Date:
    Created: 20000501

    Modified: 20190201

Definition in file matrix_linear.h.

Function Documentation

  Vector3<double> fit_plane (Matrix a, vector< double > b)

Solves for fitting a plane through a model.

Parameters:
    a 3x3 matrix with cross-terms.
    b 3 vector with averages.

Returns:
    Vector3<double> plane normal.

    A plane is fit through the components and the normal calculated from:
        n•p = d
    where n is the normal vector, p is a point in the plane, and d is the offset.

Definition at line 227 of file matrix_linear.cpp.

  double fit_polynomial (int n, double * x, double * y, int order, double * coeff)

Fits a data set to a polynomial function.

Parameters:
    n number of data points.
    *x x array (at least order+1 values).
    *y y array (at least order+1 values).
    order polynomial order.
    *coeff array in which coefficients are returned (order+1 values) (if NULL, no coefficients returned).

Returns:
    double the deviation.

    A polynomial of any order is fitted to the data using a least squares.
    The polynomial is defined as:
        f(x) = a0 + a1*x + a2*x^2 + ...
    The number of coefficients returned is the order plus one.
    The deviation is defined as:
        R = sqrt(sum(y - f(x))^2/n)

Definition at line 166 of file matrix_linear.cpp.

  double fit_polynomial (int n, vector< double > & x, vector< double > & y, int order, vector< double > & coeff)

Fits a data set to a polynomial function.

Parameters:
    n number of data points.
    &x x array (at least order+1 values).
    &y y array (at least order+1 values).
    order polynomial order.
    &coeff array in which coefficients are returned (order+1 values) (if NULL, no coefficients returned).

Returns:
    double the deviation.

    A polynomial of any order is fitted to the data using a least squares.
    The polynomial is defined as:
        f(x) = a0 + a1*x + a2*x^2 + ...
    The number of coefficients returned is the order plus one.
    The deviation is defined as:
        R = sqrt(sum(y - f(x))^2/n)

Definition at line 99 of file matrix_linear.cpp.

  double linear_least_squares (int n1, int n2, double * x, double * y, double & a, double & b)

Does a linear least squares fit between two vectors.

Parameters:
    n1 the starting index in each vector (usually 0).
    n2 the final index in each vector.
    *x x vector (at least n2+1 elements).
    *y y vector (at least n2+1 elements).
    &a the intercept.
    &b the slope.

Returns:
    double the correlation index.

    The two input vectors must have elements between indices n1 and n2.

Definition at line 28 of file matrix_linear.cpp.

Author

Generated automatically by Doxygen for Bsoft from the source code.