I'm looking into interpolating a signal by 2x and came into this matlab function
Interpolation — increase sampling rate by integer factor
interp uses the lowpass interpolation algorithm 8.1 described in 1.
1.It expands the input vector to the correct length by inserting 0s between the original data values.
2.It designs a special symmetric FIR filter that allows the original data to pass through unchanged and interpolates to minimize the mean-square error between the interpolated points and their ideal values. The filter used by interp is the same as the filter returned by
3.It applies the filter to the expanded input vector to produce the output.
Interpolation FIR filter design
The bandlimited method uses
firlsto design an interpolation FIR filter. The polynomial method uses Lagrange's polynomial interpolation formula on equally spaced samples to construct the appropriate filter.
Finally the documentation of
firls is here
In short, the algorithm of
interp is to insert
l-1 zeros between each pair of neighboring input samples (up-sampling) and FIR filter it, where
l is the multiplier of interpolation. The FIR filter is designed by
intfilt(2,4,0.5) returns a 15-tap FIR filter with
0.5*fs/2 cut-off for 2x interpolation, in this case:
[-0.0068, 0.0000, 0.0395, -0.0000, -0.1427, 0.0000, 0.6098, 1.0000, 0.6098, 0.0000, -0.1427, -0.0000, 0.0395, 0.0000,-0.0068]
In the above example: all the even coefficients are 0 and the middle coefficient is 1. Recall that this FIR filter is to be used with a 2x up-sampled signal, this means the "original" sample in the input will be unchanged (only multiplied with the center 1), while all the inserted 0s will the calculated by the FIR filter.
This offers two useful properties: 1) computational efficiency: "original" samples are unchanged; 2) lossless-ness: interpolation then down-sample leaves the original signal unchanged.
I found the source code for
intfilt and it calls
F = [0, 0.1250, 0.3750 , 0.5000] and
M=[2, 2, 0, 0], then returned
h is the same as
h = intfilt(2,4,0.5);
M combination would set all even coefficients of
h to 0?