Monday, July 14, 2014

Signal Interpolation

In the mathematical field of numerical analysis, interpolation is a method of constructing new data points within the range of a discrete set of known data points.
In engineering and science, one often has a number of data points, obtained by sampling or experimentation, which represent the values of a function for a limited number of values of the independent variable. It is often required to interpolate (estimate) the value of that function for an intermediate value of the independent variable. This may be achieved by curve fitting or regression analysis.
A different problem which is closely related to interpolation is the approximation of a complicated function by a simple function. Suppose the formula for some given function is known, but too complex to evaluate efficiently. A few known data points from the original function can be used to create an interpolation based on a simpler function. Of course, when a simple function is used to estimate data points from the original, interpolation errors are usually present; however, depending on the problem domain and the interpolation method used, the gain in simplicity may be of greater value than the resultant loss in accuracy.
Kinematic interpolation is an important tool in biomechanics. However, perhaps for lack of better options, are more used linear interpolation and Cubic Spline. Other possibilities are effective, as found by Coburn & Crisco (2005) found that displacement errors below 2% using the Hermite method using 4% of the total samples, representing a decrease in error over other algorithms.
In mathematics, the Hermite polynomials are a classical orthogonal polynomial sequence that arise in probability, such as the Edgeworth series; in combinatorics, as an example of an Appell sequence, obeying the umbral calculus; in numerical analysis as Gaussian quadrature; in finite element methods as shape functions for beams; and in physics, where they give rise to the eigenstates of the quantum harmonic oscillator. They are also used in systems theory in connection with nonlinear operations on Gaussian noise. They were defined by Laplace (1810) though in scarcely recognizable form, and studied in detail by Chebyshev (1859). Chebyshev's work was overlooked and they were named later after Charles Hermite (1864) although Hermite's paper actually dealt with the multidimensional form of the polynomials.
Let l(x) be an nth degree polynomial with zeros at x_1, ..., x_n. Then the fundamental Hermite interpolating polynomials of the first and second kinds are defined by
h_nu^((1))(x)=[1-(l^('')(x_nu))/(l^'(x_nu))(x-x_nu)][l_nu(x)]^2
and
h_nu^((2))(x)=(x-x_nu)[l_nu(x)]^2
for nu=1, 2, ...n, where the fundamental polynomials of Lagrange interpolation are defined by
l_nu(x)=(l(x))/(l^'(x_nu)(x-x_nu)).
They are denoted h_nu(x) and h_nu(x), respectively, by Szegö (1975).
These polynomials have the properties
h_nu^((1))(x_mu)=delta_(numu)
h_nu^((1))^'(x_mu)=0
h_nu^((2))(x_mu)=0
h_nu^((2))^'(x_mu)=delta_(numu).
for mu,nu=1, 2, ..., n. Now let f_1, ..., f_n and f_1^', ..., f_n^' be values. Then the expansion
W_n(x)=sum_(nu=1)^nf_nuh_nu^((1))(x)+sum_(nu=1)^nf_nu^'h_nu^((2))(x)
gives the unique Hermite interpolating fundamental polynomial for which
W_n(x_nu)=f_nu
W_n^'(x_nu)=f_nu^'.
If f_nu^'=0, these are called Hermite's interpolating polynomials.
The fundamental polynomials satisfy
h_1^((1))(x)+...+h_n^((1))(x)=1
and
sum_(nu=1)^nx_nuh_nu^((1))(x)+sum_(nu=1)^nh_nu^((2))(x)=x.
Also, if dalpha(x) is an arbitrary distribution on the interval [a,b], then
int_a^bh_nu^((1))(x)dalpha(x)=lambda_nu
int_a^bh_nu^((1))^'(x)dalpha(x)=0
int_a^bxh_nu^((1))^'(x)dalpha(x)=0
int_a^bh_nu^((2))(x)dalpha(x)=0
int_a^bh_nu^((2))^'(x)dalpha(x)=lambda_nu
int_a^bxh_nu^((2))^'(x)dalpha(x)=lambda_nux_nu,
where lambda_nu are Christoffel numbers.
Here's a link to download Matlab Code with a sub-program implemented in environment Matlab© to get interpolated signal.
To use the function provided just save the file "int_gbiomech.m" in the same folder as the data to be analyzed. Then just call in your Matlab routine sub-program as follows in the example below:

your_interpolated_signal=int_gbiomech(Signal,fs_signal,fs_interpolated);

where:
your_interpolated_signal = output variable with your interpolated signal with new number of samples.
Signal = the signal you want to change the frequency.
fs_signal = the natural frequency of your signal.
fs_interpolated =  The new frequency that your interpolated signal will have.


Note: you can specify the window which will be modified by inserting an index on the input variables.

References:

- Bartels, R. H.; Beatty, J. C.; Barsky, B. A. "Hermite and Cubic Spline Interpolation." Ch. 3 in An Introduction to Splines for Use in Computer Graphics and Geometric Modelling. San Francisco, CA: Morgan Kaufmann, pp. 9-17, 1998. 
- Chebyshev, P. L. Sur le développement des fonctions à une seule variable Bull. Acad. Sci. St. Petersb. I, 193-200; Oeuvres I 501-508, 1859.
- Coburn, J. C.; Crisco, J. J. Interpolating three-dimensional kinematic data using quaternion splines and hermite curves. J. Biomech. Eng. 127, 311-317, 2005. 
- Hermite, C. Sur un nouveau développement en série de fonctions C. R Acad. Sci. Paris 58, 93-100; Oeuvres II 293-303, 1864.
- Hildebrand, F. B. Introduction to Numerical Analysis. New York: McGraw-Hill, pp. 314-319, 1956.
- Laplace, P. S. Théorie analytique des probabilités. livre 2, 321-323; Oeuvres VII, 1812.
- Szegö, G. Orthogonal Polynomials, 4th ed. Providence, RI: Amer. Math. Soc., pp. 330-332, 1975.

Big Hug!