Main page
Least-square method
Let us have the set of values y_{i} , every one of which corresponds to any
moment of time t_{i} (i = 1,2,…,N). We need to find dependency y = f(t)
if the sum of squared divergences of points of curve from the appropriate point
y_{i} is the minimal in the class of approximating functions. That is
(1) Σ (f(t_{i} )
– y_{i} )^{2} → min
We will find the solution in the class of the linear functions (straight lines):
y = at + b. Then the term (1) we can write as the following
Σ (a*t_{i} +b – y_{i} )^{2}
→
min
The necessary condition of the existence of minimum is the equality to zero of two
partial derivatives on a and b accordingly:
Σ ((a*t_{i} +b – y_{i} )*t_{i} )
=0
Σ (a*t_{i} +b – y_{i} )
= 0
In designations
Σ (t_{i} *t_{i} ) = stt
Σ (y_{i} *t_{i} ) = syt
Σ (t_{i} ) = st
Σ (y_{i} ) = sy
the system can be rewritten as the following
a*stt + b*st – syt = 0
a*st +b*N – sy = 0
Solving this system of two linear equations for a and b we will get
a = (syt*N – sy*st)/(N*stt – st*st)
b = (stt*sy – syt*st)/(N*stt – st*st)
Main page