icon-komplexe-Zahl Regression (curve fitting)

Regression

Regression or fiting methods referred to a series of measurement data to determine the parameters of a given function or best to approach.

Least Square Fit

The least squares method is to determine the parameters of a curve such that the root mean square deviation is minimized. In statistics, the method of regression analysis will be used.

Fourier Series

The development of a periodic function into a series of trigonometric functions does the Fourier series. The development of a function in its Fourier series is known as harmonic analysis.

Mean values ​​and standard deviation

The arithmetic means

x = 1 n i = 1 n x i

y = 1 n i = 1 n y i

Standard deviation from the mean

σ = 1 n-1 i = 1 n x i - x 2

For the standard deviation of the regression line of the average value of x of the relevant function value of the straight line is to be replaced.

Fit line for power laws

If the measured values ​​is an exponential relationship is based can also be used for the best fit straight line linear model. Therefore it is necessary to take the logarithm, the measured values​​, because then gives a linear equation by substitution.

y = b a x

Logarithm leads to a linear equation.

ln y = ln b + x ln a

With the logarithm of measured values ​​y' and the substitutions a' = ln a and b'= ln b is present, the linear model.

y' = b' + a' x

Regression

The regression analysis is used for determining or estimating model parameters. The starting point are measured values ​​and a model that the measured values ​​should be based on. Since the measured values ​​generally subject to fault optimizes the regression analysis, the model parameters to optimal adaptation. The basic procedure is the method of least squares.

Least square method

The method of least squares, a method of compensation calculation. With the method, an optimum compromise is calculated, in which the squares of the deviations are minimized by the model function.

With respect to the measured values ​​(x i , y i ) and the model function f is the quadratic deviation is minimized. To achieve this, the parameters a i of the model function are determined so that the following condition is satisfied.

i = 1 n f x i a - y i 2 min

Model function: Linear fit

For the determination of the regression line is a linear model function f is used for the least squares method.

f x a = a 0 + a 1 x

The deviation of the regression line to the measured values ​​is then given as follows.

a0+a1x1-y1=r1 a0+a2x2-y2=r2 a0+anxn-yn=rn

The goal now is the sum of squares of the deviations from a straight line r to make as small as possible.

i = 1 n r i 2 = a0+a1x1-y1 2 + + a0+anxn-yn 2 min

The extremum is determined by the partial derivatives with respect to a 0 and a be set 1 zero.

a0 a0+a1x1-y1 2 + + a0+anxn-yn 2 = 0

a1 a0+a1x1-y1 2 + + a0+anxn-yn 2 = 0

The resolution of the equation system provides the parameters a 0 and a 1 of the regression line.

a0 =y-a1x

a1 = i = 1 n x i - x y i - y i = 1 n x i - x 2

Calculator: fit line

Number of measurement points n=

Enter the measured values: x1, y1, x2, y2, ...

Model function: power functions

The approximation of a power function is performed by returning to the linear model function.

y = a x b

Logarithm leads to a linear equation.

ln y = ln a + b ln x

With the logarithmic measurement values ​​y 'and the substitutions a' = ln a and x '= ln x is the linear model before.

y' = a' + b x'

Calculator: For power function

Number of measurement points n=

Enter the measured values: x1, y1, x2, y2, ...

Approximation (fit) der Gauß-Verteilung an Messwerte

Die Gauß-Verteilung auch Normalverteilung genannt ist folgendermaßen definiert:

fx = 12πσe-12x-μ2σ2

Calculator: Normal distribution

The adaptation (fit) of the Gaussian distribution to the measured values takes place by forming the weighted mean value of the measured values. The weighted mean value corresponds to the μ In the Gaussian distribution. The standard deviation of the measured values from the mean value is the σ in the normal distribution.

μ= i = 1 n x i y i i = 1 n y i

σ = i = 1 n x i - μ 2 y i i = 1 n y i

Number of measuring points n=

Enter the measured values: x1, y1, x2, y2, ...

Model function: Periodically (Fourier series)

Measured values ​​can also be approximated by the periodic functions. The procedure for this is the development of a Fourier series. The elements of the Fourier series are sine and cosine functions. The development takes place in ascending order of frequencies.

The Fourier series is:

snx= a 0 2 + k = 1 n a k cos k ω x + b k sin k ω x

with the Fourier coefficients a k and b k and ω = 2π / T. This is the period T = b - a with the initial interval a and the end of interval b.

The Fourier coefficients a k and b k satisfy the least squares condition for the associated sine or cosine function. The coefficients are calculated as follows.

ak= 2 l a b f x cos k ω x dx

bk= 2 l a b f x sin k ω x dx

Calculator: Fourier approximation

Number of measurement points n=

x-min=

x-max=

Enter the measured values: x1, y1, x2, y2, ...

Number of Fourier terms k=

Fourier coefficients

The Fourier coefficients a k and b k are here computed numerically using the trapezoidal method for the numerical integration. The accuracy can be improved by increasing the number of measurements is increased in the interval.

Polynomial approximation using the QR method

The linear approximation problem is solved by the QR decomposition. The calculator determines the coefficients of the n-th degree polynomial.

The starting point is the over-determined system of equations:

Ax=b

withxRnundARnxm

The QR decomposition leads to the factorization of the matrix A:

A=QR

This applies to the compensation problem:

Ax-b22= QRx-b22= R*x-QT*b22

here R and Q are reduced to the relevant proportion. That is, R * is the upper triangular matrix of R and Q T * contains the corresponding rows of Q.

Replacing A by the Vandermond matrix with the corresponding measured values x i and b by the measured values y i yields the coefficients of the compensating polynomial as the solution of the equation system.

Calculator: Polynomial approximation

Number of measuring points n=

Degree of the polynomial =

Enter the measured values: x1, y1, x2, y2, ...