Let us approximate by a linear combination of functions
(2.1) |
by the least square method (the square error is minimum),
(2.2) |
For a discrete set of data , is given by a column matrix , the set of coefficients by a column matrix , and a rectangular matrix with elements corresponds to values at points , in columns. In the discrete case the square error is
(2.3) |
In the case , is a square matrix and if it is not singular, the error is minimum if the expression in the square brackets is zero. It follows is the solution of the following linear equation
(2.4) |
In the case we have more equations than unknowns the differentiation with respect to leads to the following expression
(2.5) |
It corresponds to the following matrix equation
(2.6) |
The relative error is .
Let us consider the approximation of measured damped free vibrations by the solution of the linear theory. Thus for the case of one degree of freedom the square error
(2.7) |
should be minimum. In the integral is known and are displacements of the terms, is the frequency in Hz and is the damping coefficient in 1/s. It is convenient to introduce the following notation: , , , ,
The necessary condition that the square error is minimum corresponds to the condition that all partial derivatives are zero
(2.8) |
The problem is solved usually by iterations. The choice of estimated initial values is very important to obtain a convergent procedure. A simple and traditional method of approach is to expand the function under the integral in Taylor series and to consider three terms only.
(2.9) |
Upon substitution and integration the function is a function of known (assumed) initial values and the unknown increments . It is a second order power series in the increments. To minimize the value of the square error the partial derivatives with respect to should be zero. This condition leads to four linear equations that, if the determinant is not singular, yield the values of the increments. The new value of the estimates is equal to the sum of the previous estimates and the calculated increments .
If the procedure converges, the step by step procedure leads to small values of the square error, that are satisfactory for the considered problem.
Example 1
The script file pwoprp03 calculates the Fourier series of a periodic
soliton as a function of time for different shifts in space x and
compares with solutions of approximations by trigonometric functions.
The solutions when the orthogonal properties of the set of functions
are not used are better.
Download
Scilab: pwoprp03.sci, unwrap.sci, ellipj.sci, ellipke.sci
Octave/Matlab: pwoprp03.m
Example 2
The script file pwoprq03 calculates the Fourier series of a periodic
soliton and discusses the problem of taking s points less compared
with the perfect period. The approximation is not sensitive to such
errors.
Download
Scilab: pwoprq03.sci, unwrap.sci, ellipj.sci, ellipke.sci
Octave/Matlab: pwoprq03.m
Example 3
The script file pwoprr03 calculates the Fourier series of a periodic
soliton and discusses the problem when additionally two and three
periods are considered. Such a change does not change a solution for
a perfect period.
Download
Scilab: pwoprr03.sci, ellipj.sci
Octave/Matlab: pwoprr03.m
Example 4
The script file pwoprt03 approximates damped free vibrations by the
expression for linear not damped oscillations and damped vibrations.
The iterations converge.
Download
Scilab: pwoprt03.sci
Octave/Matlab: pwoprt03.m
Example 5
Script file pwoprv03 is used to study the measured damped vibrations.
The column matrix of measured values is denoted by Y, its elements
by Y(r). We introduce the following column matrices E(r)=exp(-x3*r*dt),
C(r)=cos(2*pi*x4*r*dt),S(r)=sin(2*pi*x4*r*dt), R(r)=r*dt; We introduce
the following notations: EC=E.*C, ES=E.*S, REC=R.*EC, RES=R.*REC,
RREC=R.*REC, RRES=R.*RES. The column matrix of errors is EY=Y-x1*EC-x2*ES,
the mean square error is a scalar EJ=EY'*EY; The variance of Y is
V=mean(Y'*Y) and thus the relative error is RE=sqrt(EJ/V).
Download
Scilab: pwoprv03.sci
Octave/Matlab: pwoprv03.m