Note: This project is adapted from Computer-Based Exercises for Signal Procexssing Using Matlab by Burrus et al.
Overview
The process of interpolation essentially corresponds to estimating or re- constructing the values of a signal at locations (times) between the sample values. Figure 4.23 in O&S depicts a system for interpolating a signal by a factor of L. The signal x[n] is first upsampled by inserting L − 1 between samples of x[n]. Then, the lowpass filter interpolates between nonzero values of xe[n] to generate the interpolated signal xi[n]. When the lowpass filter is ideal, the interpolation is referred to as bandlimited interpolation.
Accurate bandlimited interpolation requires a carefully designed high- order lowpass filter. Two simple and very approximate procedures which are often used instead are zero-order hold and linear interpolation. For zero-order hold interpolation, each value of x[n] is simply repeated L times:
x[0], for0≤n≤L−1 e
xe[L], forL≤n≤2L−1 xe[2L], for2L≤n≤3L−1
xi[n] =
This can be accomplished by convolving xe[n] with the impulse response
L−1
hzoh[n] = δ[n − k]
k=0
Zero-order hold interpolation is often used in digital-to-analog converters, resulting in analog “stairstep” waveforms.
Linear interpolation can be accomplished using a system with impulse
. . . .
response
Unlike the zero-order hold interpolator, the linear interpolator is noncausal and has zero group delay.
Note that the ideal bandlimited interpolator (a sinc function) also has a noncausal impulse response.
1. Given xe[n] as defined in Figure 4.23 of O&S write the difference equa- tions that correspond to the zero-order hold (ZOH) interpolation filter
hlin[n] =
1−|n|/L, for0≤|n|≤L−1 0, otherwise
ECE 535: Digital Signal Processing — Project 1 3 and the linear interpolation filter for the impulse responses hzoh[n] and
hlin [n].
- Enter the impulse responses for the ZOH and linear interpolators into Matlab using the value L = 5. Note that the linear interpolator is a noncausal filter. Since Matlab doesn’t recognize negative indices, you must enter a causal version, and then “time advance” the result by relabeling the time axis appropriately. Assign the impulse response sequences to the Matlab variables hzoh and hlin, respectively. Use the Matlab function stem to plot the two impulse responses as a function of sample index n. Make sure the sample index values n are correct!
- Use the Matlab command fft to compute the frequency responses of the two filters. (Use a value for the FFT length N that is sufficiently large to give you a smooth approximation to the DTFT.) Plot the magnitude of the frequency responses of the ZOH and linear interpolation filters on the same graph. Use a linear (not logarithmic) scale. Label the hor- izontal axis in terms of frequency,ω. Draw (by hand or via Matlab) the magnitude of the ideal interpolation filter on your plot, as well. Which filter is a better approximation to the ideal bandlimited interpolator?
- Using the Matlab functions upsample and filter, implement the inter- polation system with L = 5. (Note that, when using filter with an FIR filter, you’ll want to set b equal to the filter impulse response and a equal to 1.) Perform the interpolation using (i) the ZOH and (ii) the linear interpolator. For input to the system, use the sequence data1 that has been provided in mp1DataFile.mat. Assign the interpolated sequences to the Matlab variables xzoh and xlin.
- Using stem, plot the sequences xzoh and xlin on a sample axis from n = −10 to n = 20. In establishing the sample (time) axis for the plot, be sure to take into account that hlin[n] is noncausal. You can check whether or not you have the time axis appropriately lined up for xzoh1 and xlin1 by noting that for both the ZOH and the linear interpolator, all the values of the original data are preserved exactly on the expanded sample (time) axis.
- The Matlab variable hsharp contains the impulse response of an inter- polation filter that more closely approximates the ideal lowpass filter
ECE 535: Digital Signal Processing — Project 1 4
than either the linear interpolator or the ZOH interpolator. This fil- ter (hsharp) is noncausal, and its impulse response has even symmetry about n = 0. Use stem to plot this impulse response as a function of n. Again, make sure the sample index values n are correct!
- Plot (on a linear scale) the magnitude of the frequency response of the filter hsharp. How does it compare to the ZOH and linear interpolators? How does it compare to the ideal interpolation filter?
- Interpolate the sequence data1 using hsharp. Assign the resulting se- quence to the Matlab variable xsharp. Using stem, plot xsharp on a sample axis from n = −10 to n = 20.
- In the items above, we have implemented the interpolation system with L = 5 for three different filters. In the final item, we want to compare the results with essentially ideal bandlimited interpolation. To do this, we need to be careful about comparing appropriate segments of xi[n].
- (a) For each of the three filters, with the appropriate time advance incorporated, specifythe range of n over which xi[n] is available. (Pay attention to the output of the filter command. How does its output differ from the output of conv, the convolution function?)
- (b) From your answer to part (a), what is the largest interval common to all three filtered outputs?
- (c) AnotherissueisthattheMatlabfunctionfilterassumesthatdata1 is zero for n < 0, and consequently, there is a startup transient in filtering until the filter impulse response totally engages the data. The duration of this transient depends on the length of the FIR filter. The three filtered outputs should only be compared after the transient. Taking this into account together with your answer to part (b), xzoh, xlin, and xsharp should be compared only over a common time interval n1 ≤ n ≤ n2. Determine n1 and n2.
- As a final task, we evaluate the performance of the various interpolation filters compared withwhat would be obtained by essentially bandlim- ited interpolation. The sequence corresponding to perfect bandlimited interpolation is contained in the Matlab variable ideal1. A measure of
ECE 535: Digital Signal Processing — Project 1 5 the average interpolation error is
ex =
1 n=n2
|xi[n] − xideal[n]|2.
n2 −n1 +1n=n1
Use Matlab to compute the average interpolation error for the three filters. Which interpolation filter has the best performance? Is this what you expected?



