I'm looking into interpolating a signal by 2x and came into this matlab function interp:


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 intfilt.

3.It applies the filter to the expanded input vector to produce the output.

Then about intfilt:


Interpolation FIR filter design


The bandlimited method uses firls to 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.

E.g. 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 h=firls(n-1,F*2,M); with n=15, 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);

Why this n/F/M combination would set all even coefficients of h to 0?


The filter you describe is called a halfband filter. It is symmetric with respect to half the Nyquist frequency ($f_s/4$). The function firls computes the least squares optimal filter. As long as the desired magnitude and the edge frequencies result in a symmetric specification, the optimal approximation will also be symmetric, and, consequently, will be a halfband filter with every other sample away from the center tap equal to zero (up to numerical accuracy).

So any specification for firls of the form

f = [0,0.5-x,0.5+x,1];
m = c*[1,1,0,0];

with $0<x<0.5$ and $c>0$, and an odd filter length will result in a halfband filter.

  • $\begingroup$ I think another explanation could be, the ideal filter would be an approximate to a sampled sinc, and if conditions meet the FIR filter will sample at exactly at the zero-crossing point of the sinc. Also this is not limited to a halfband filter, but could be 1/N filter in general. $\endgroup$ – user3528438 Feb 14 '17 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.