Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit


Digital Signal Processing Labs (PGEE11108)

Marked Assignment 1

Sampling, Aliasing, and Reconstruction

 

Instructions

This assignment forms the first part of the marked assessment process for Digital Signal Processing Labs course PGEE11108.    The completed solution for this assignment must be submitted via Learn by the deadline above. All solution reports should be in the form of a word document. Submissions should be made up of two elements:

1.    A report of no more than 3 pages (excluding appendix) describing your understanding of the problem and providing a    detailed description of your proposed solutions and observations. All figures must be included within the 3 page limit and should be clearly presented and fully and correctly labelled.

2.    MATLAB code created in the exercise should be fully commented and included in the appendix of the report. No other material may be included in the appendix

 

Marks will be awarded for the following components of the work: Overall presentation 10%, Problem understanding 50%, and Results and Conclusions 40%.

NOTE: MATLAB HAS A NUMBER OF SPECIFIC ROUTINES FOR INTERPOLATION OR RE-SAMPLING OF SIGNALS. THESE

ARE NOT TO BE USED FOR THE PURPOSES OF THIS LAB.

Sampling, Aliasing, and Reconstruction

Background

Digital signals and images are often provided with standard sampling rates (audio) . For example, high quality music is usually       sampled at 44 kHz while for telephone quality speech it is sufficient to sample between 5-8 kHz. Moving from one sampling rate to another is called digital resampling and a very useful tool in DSP. This lab will look at audio resampling, filtering and (simulated)    analog reconstruction.

Digital Resampling

If the two sampling frequencies are integer valued then re-sampling can be achieved by the following steps:

1.    Up sampling: An up sampled version of the signal (with aliasing) can be generated by interleaving the original samples with the appropriate number of 0s.

2.    Anti-aliasing filter: to remove any aliasing that might occur in the resampling process it is necessary to low pass filter the up-sampled signal at the appropriate rate.

3.    Down sampling: to reduce the sampling rate it is now only necessary to retain the appropriate samples.


Analog Reconstruction

While the process of moving from discrete time to continuous time can be described mathematically through the notions of the         sampled signal spike train and the ideal low pass filter, as explained in the lab notes, in practice a Digital to Analog Converter (DAC) cannot generate such a sampled signal spike train. A better mathematical description of the DAC process is the zeroth order hold    (ZOH) model. It models the analog output as holding the sample signal value at a constant level for the duration of the sample

interval. This is illustrated in the figure below.

 

The ZOH output can then be subsequently filtered by an analog low pass filter (LPF) to remove aliasing. The whole analog reconstruction process is then as follows:

 

ZOH

 


Analog output

signal


Low pass filter design

For both the digital resampling and the simulated analog reconstruction you will need to design an appropriate low pass filter. The    ideal anti-aliasing filter is a digital sinc function of the appropriate bandwidth. In the exercise below you may approximate this with an appropriately truncated sincfunction as in the lab sessions, or you may use MATLAB’s filter design function call FIR1. The      output of FIR1 is the filter’s impulse response function which can then be convolved with the input signal. Care must be taken in      selecting a suitable filter length and the correct cut-off frequency.

NOTE: The frequency response function for a filter can be plotted using MATLAB’s freqz function.

Assignment

1)   Audio re-sampling

Write a MATLAB function of the following form:

function output_signal = audio_resample(input_signal,Fin,Fout)

The function should take a signal in the form of a vector, input_signal, that has been sampled at frequency, Fin Hz, and generates a resampled signal, output_signal, sampled at Fout Hz.

Describe your implementation in your report and include details of how aliasing has been avoided. Explain any design decisions made.

2)   Analog ZOH output

In your report explain how the ZOH process can also be described mathematically in terms of the sample signal spike train and an associated filter, detailing the filter characteristics.

3)   Audio re-sampling, filtering and reconstruction

Using your resampling function write a Matlab script to perform the following steps:

a)    Load in the audio file trumpet.wav from the Resources directory which is sampled at 22kHz


b)    Use your function from part (1) to resample the signal to 8kHz sampling rate

c)    Filter the resampled signal with the impulse response function in the audio file phoneIR8k.wav from the Resources directory, which is sampled at 8kHz

d)    Finally, simulate an analog reconstruction process using a ZOH process followed by an ideal low pass filter. For your  simulation use a discrete sampling rate of 44kHz as a reasonable approximation to the continuous time analog signal.

Your report should describe in detail the key steps at each stage, illustrating the intermediate steps of the process with appropriate plots and explaining any key decisions that you have made in your code.

4)    Improved analog reconstruction

Discuss any inaccuracy introduced by the ZOH process and describe how additional digital filtering might be used to compensate for this.