interp
Interpolation is an increase in the sampling rate by an integer number of times.
| Library |
|
Arguments
Input arguments
# x — input signal
+
vector
Details
The input signal is set as a vector.
| Типы данных |
|
# r is the interpolation coefficient
+
a positive integer
Details
The interpolation coefficient, set as a positive integer.
| Типы данных |
|
# n is half the number of input sample values used for interpolation
+
4 (by default) | a positive integer
Details
Half of the number of input sample values used for interpolation, set as a positive integer. For best results, use n no more than 10. The length of the low-pass interpolation filter is 2 × n × r + 1.
| Типы данных |
|
# cutoff — normalized cutoff frequency
+
0.5 (by default) | positive scalar
Details
The normalized cutoff frequency of the input signal, set as a positive real number of no more than 1, which is a part of the Nyquist frequency. Meaning 1 This means that the signal occupies the entire Nyquist interval.
| Типы данных |
|
Output arguments
# b — coefficients of the low-pass interpolation filter
+
column vector
Details
The coefficients of the low-pass interpolation filter returned as a column vector.
| Типы данных |
|
Examples
Signal interpolation
Details
Let’s create a sinusoidal signal with a sampling frequency 1 kHz. We interpolate it with the coefficient 4.
import EngeeDSP.Functions: interp
t = 0:1/1e3:1
x = sin.(2π*30*t) .+ sin.(2π*60*t)
y = interp(x, 4).y
Let’s plot the original and interpolated signals.
plot(
plot(0:30, x[1:31], seriestype = :stem, markershape = :circle, markerstrokewidth = 0, markersize = 3,
xlabel = "Sample Number", ylabel = "Original", grid = true),
plot(0:120, y[1:121], seriestype = :stem, markershape = :circle, markerstrokewidth = 0, markersize = 3,
xlabel = "Sample Number", ylabel = "Interpolated", grid = true),
layout = (2, 1)
)
Algorithms
Interpolation increases the initial sampling rate of the sequence. This is the opposite of thinning. Function interp inserts zeros into the original signal, and then applies a low-pass interpolation filter to the extended sequence. The function uses the low-pass interpolation algorithm 8.1 described in [1]:
-
Expand the input vector to the desired length by inserting zeros between the original data values.
-
To design a special symmetric FIR filter that passes the original data unchanged and interpolates them to minimize the RMS error between the interpolated points and their ideal values. The filter used by the function
interp, matches the filter returned byintfilt. -
Apply a filter to the expanded input vector to get the output value.
Literature
-
Digital Signal Processing Committee of the IEEE Acoustics, Speech, and Signal Processing Society, eds. Programs for Digital Signal Processing. New York: IEEE Press, 1979.
-
Oetken, G., Thomas W. Parks, and H. W. Schüssler. «New results in the design of digital interpolators.» IEEE® Transactions on Acoustics, Speech, and Signal Processing. Vol. ASSP-23, No. 3, June 1975, pp. 301–309.