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

300069 Digital Signal Processing

Laboratory Practical 1

DISCRETE-TIME SIGNAL ANALYSIS

I. Aim

A major goal of processing a signal is to modify the signal for a particular purpose or extract information from the  signal.  To  achieve  this  goal,  the  signal  should  always  be  analysed  beforehand  so  as  to  identify  its characteristics. For example, in order to recover a signal that has been contaminated by noise, the characteristics of the noise and the signal should be identified so that appropriate filters can be designed to remove the noise but preserve the signal of interest. This laboratory practical aims to identify characteristics of discrete-time signals in the time domain and in the frequency domain. Synthetic signals and real-world signals are used for this purpose.  The major tool for signal analysis in this case is MATLAB Signal Processing Toolbox (SPTool). Techniques developed in this practical will be used for two subsequent laboratory practicals, namely discrete- time filter design and discrete-time filter applications.

II. Pre-work

NB: Your pre-work must be signed off by the lab supervisor in the lab time allocated (7:30pm, 25-Nov-2020) .

A discrete-time signal is often obtained from a continuous-time signal by periodic sampling. If the continuous- time signal is band-limited, its spectrum can be recovered from the spectrum of the corresponding discrete-time signal,  provided  the  sampling  frequency  is  sufficiently  high,  according  to  the  sampling  theorem.  Hence, the evaluation of the spectrum of the continuous-time signal, which involves the tedious integral, is reduced to the evaluation of the spectrum of the discrete-time signal, which involves only a finite number of samples.

In this section, we review the basic concepts for finding the spectrum of a continuous-time signal. In the next section (Lab work), we will analyse the spectra of discrete-time signals using MATLAB SPTool.

The spectrum of a continuous-time signal x(t) can be obtained from the Fourier transform:

X(j) x(t)e jtdt ,

where is the angular frequency, measured in radians/second.

If x(t) is periodic with period T, it can also be expressed as a Fourier series:

x(t) ak ejk0 t ,

k

where 0 and ak T x(t)e jk 0 t dt . It can be proven the Fourier transform of this periodic signal x(t) is

X(j) 2ak( k0 ),                                                                                                            (1)

k

where () is  the continuous - variable  impulse function, i.e.,

() and ba()d

Given below are some examples of continuous-time periodic signals.

1.   A sinusoidal signal x(t) cos(0t) .

0, k 1 or 1

Please complete the following and fill in Table 1 with your results.

a.   Find X(j) using Equation (1).

b.   Sketch x(t) with respect to t, indicating the maximum values and intercepts with the coordinate axes.

c.    Sketch X(j) with respect to , indicating the maximum values and intercepts with the

coordinate axes.

T

2.   A square wave x(t) 1,    |T(t |) 4 T , repeating periodically with period T, i.e., x(t) x(t T) .

0, | t |

For this signal, it can be proven that ak .

Please complete the following and fill in Table 1 with your results.

a.   Find X(j) using Equation (1).

b.   Sketch x(t) with respect to t, indicating the maximum values and intercepts with the coordinate axes.

c.    Sketch X(j) with respect to , indicating the maximum values and intercepts with the coordinate axes.

3.   An impulse train x(t) (t kT) where (t) is the continuous-variable impulse function. k

For this signal, it can be proven that ak .

Please complete the following and fill in Table 1 with your results.

a.   Find X(j) using Equation (1).

b.   Sketch x(t) with respect to t, indicating the maximum values and intercepts with the coordinate axes.

c.    Sketch X(j) with respect to , indicating the maximum values and intercepts with the coordinate axes.

Table 1: Three periodic continuous-time signals and their Fourier transforms.

Continuous-time

signal x(t)

X(j)

Sketch of x(t) , indicating the maximum values and  intercepts with the            coordinate axes

Sketch of X(j) ,            indicating the maximum  values and intercepts with the coordinate axes

x(t) cos(0t)

T

1,    | t | 4

0, | t |  ,

and x(t) x(t T) .

x(t) (t kT) k

Pre-work (Table 1)

Signed off by the lab supervisor: Date: ............................. ..........

Raw mark awarded (out of 2):


III. Lab work

NB: Your lab work must be signed off by the lab supervisor in the lab time allocated.

Part A: Set tasks

Please download a compressed folder Lab1Signal.zip’ from the unit’s vUWS site to your computer and then extract all files from the compressed folder using WinZip (right-click on Lab1Signal.zip’ Extract All …). Now, you should see eight MATLAB files, namely,  ‘sig_ 1a.mat’,  ‘sig_ 1b.mat’,  ‘sig_ 1c.mat’,  ‘sig_ 1d.mat’, ‘sig_ 1e.mat’, ‘ECG_ 1a.mat’, ‘ECG_ 1b.mat’ and Record_n_PlayAudio.m’ . The first seven files store discrete- time signals saved in MATLAB’s data format ‘ .mat’ . The eighth file can be used to record and play an audio signal captured by the microphone of a computer.

1.   Identify the characteristics of the signal, ‘sig_ 1a.mat’, in the time domain and the frequency domain (i.e., its spectrum).

This is a synthetic signal. The sampling frequency of the signal is 1000 Hz. You can view the signal in the time domain by the following steps.

Start MATLAB’ by, for example, the following sequence of clicks: Start All Programs

MATLAB MATLAB R20xx. Then, you will see a window similar to the following.

Run SPTool’ by typing sptool’ followed by Enter’ in the MATLAB Command Window’ .

Then, you will see a window similar to the following.

Import sig_ 1a.mat’ from disk. In the SPTool’ window, you can open an Import to SPTool’

window by the following sequence of clicks: File Import. Then, you will see a window similar to the following


In the ‘Import to SPTool’ window, you can select sig_ 1a.mat’ by the following clicks: From Disk Browse select the file from disk. In the same window, select sig_ 1a’ under ‘File Contents’, and move it to the Data’ section by clicking the upper arrow. Set the sampling frequency to  1000 Hz. MATLAB gives a default name sig1’ to the signal to be imported. Change the name to sig_ 1a’ .  Then you will see a window similar to the following.

Now press OK’ to import the signal.

In the SPTool’ window, you should see sig_ 1a[vector]’ in the Signals’ column. Select this

signal and click ‘View’ . Then, you will see a window similar to the following.

This is the signal in the time domain.

You can view the signal in the frequency domain, or its spectrum, by the following steps.

In the SPTool’ window, select sig_ 1a[vector]’ in the Signals’ column. Click Create’ in the

‘Spectra’ column. Then, you will see a Spectrum Viewer’ window similar to the following.

In the Spectrum Viewer’ window, select Method’ as FFT’ (fast Fourier transform) and

‘Nfft’ (number of points in FFT) as ‘1024’, and press Apply’ . It is convenient to view a spectrum if a linear magnitude scale is used. In the Spectrum Viewer’ window, this can be done by the following sequence of clicks: Options Magnitude Scale Linear. Then, you will see a window similar to the following.

This is the signal in the frequency domain, or its spectrum. The unit of the frequency is Hertz (Hz) and the unit of the FFT spectrum estimate (or the power spectral density, PSD) is power units (e.g., Watts) per Hertz.

FFT  is  an  efficient  algorithm  for  evaluating  the  spectrum  of a  discrete-time  signal.  The algorithm will be discussed in Lecture 10.

The MATLAB online Help’ manual will be useful if further assistance is needed.

The requirements for this task are listed below.

i.      Sketch the signal in the time domain and in the frequency domain. Fill in Table 2 with your results.

ii.      Save the figures showing the signal in the time domain and in the frequency domain and then include the figures in your lab report. You may copy an active screen showing your results by pressing Alt-PrintScreen’ and then paste it onto your MS WORD document.

iii.      Describe the signal in the time domain. What is the shape of the signal? Is it a periodic signal? If it is periodic, what is its period and peak-to-peak amplitude?

iv.      Describe the signal in the frequency domain. How many frequency components are there in the signal? What are the frequencies and magnitudes of five most significant frequency                   components?

2.   Identify the characteristics of the signals, ‘sig_ 1b.mat’ and sig_ 1c.mat’, in the time domain and the frequency  domain  (i.e., their  spectra). These  are  synthetic  signals.  The  sampling  frequency  of the signals is 1000 Hz.

The requirements for this task are listed below.

i.      Sketch the signals in the time domain and in the frequency domain. Fill in Table 2 with your results.

ii.      Save the figures showing the signals in the time domain and in the frequency domain and then include the figures in your lab report.

iii.      Describe each signal in the time domain. What is the shape of the signal? Is it a periodic signal? If it is periodic, what is its period and peak-to-peak amplitude?

iv.      Describe each signal in the frequency domain. How many frequency components are there in the signal? What are the frequencies and magnitudes of five most significant frequency         components?

3.   Compare the spectra of ‘sig_ 1a.mat’, ‘sig_ 1b.mat’ and ‘sig_ 1c.mat’ . This task may be completed when you write your report after the lab class.

The requirements for this task are listed below.

i.      Describe the difference between ‘sig_ 1a.mat’ and ‘sig_ 1b.mat’ in the frequency domain.

ii.      Describe the difference between ‘sig_ 1a.mat’ and ‘sig_ 1c.mat’ in the frequency domain.

iii.      Describe the difference between ‘sig_ 1b.mat’ and ‘sig_ 1c.mat’ in the frequency domain.

4.   Identify the characteristics of the signals, ‘sig_ 1d.mat’ and sig_ 1e.mat’, in the time domain and the frequency  domain  (i.e., their  spectra). These  are  synthetic  signals.  The  sampling  frequency  of the signals is 1000 Hz.

The requirements for this task are listed below.

i.      Sketch the signals in the time domain and in the frequency domain. Fill in Table 2 with your results.

ii.      Save the figures showing the signals in the time domain and in the frequency domain and then include the figures in your lab report.

iii.      Describe each signal in the time domain. What is the shape of the signal? Is it a periodic signal? If it is periodic, what is its period and peak-to-peak amplitude?

iv.      Describe each signal in the frequency domain. How many frequency components are there in the signal? What are the frequencies and magnitudes of five most significant frequency         components?

5.   Identify the characteristics of the signals, ‘ECG_ 1a.mat’ and ECG_ 1b.mat’, in the time domain and the frequency domain (i.e., their spectra). These are real-world signals (electrocardiogram signals).   The sampling frequency of the signals is 200 Hz.

The requirements for this task are listed below.

i.      Sketch the signals in the time domain and in the frequency domain. Fill in Table 2 with your results.

ii.      Save the figures showing the signals in the time domain and in the frequency domain and then include the figures in your lab report.

iii.      Describe each signal in the time domain. What is the shape of the signal? Is it a periodic signal? If it is periodic, what is its period and peak-to-peak amplitude?

iv.      Describe each signal in the frequency domain. How many frequency components are there in the signal? What are the frequencies and magnitudes of five most significant frequency          components?

6.   In this task, you will record your speech signals when you pronounce a’, ‘b’, ‘c’ and d’ and then analyse their spectra. The task is divided into the following steps.

Record  your  sound a’  using  the  MATLAB  file Record_n_PlayAudio.m’  included  in  the

compressed folder Lab1Signal.zip’. The following procedure may be used for your recording.

o Open the MATLAB file Record_n_PlayAudio.m’ by double-clicking it using the left- button of the mouse. Then you will see a MATLAB Editor showing the program in ‘Record_n_PlayAudio.m’ .

oRun the program by clicking the Run’ button on the toolbar of the Editor.

o Change the folder if asked to do so. Then the program will run and the MATLAB’s Command Window will show the sampling frequency in Hertz for the recording.

oWhen the  Command Window  shows Start recording …’, repeat  saying a’  to the microphone of the computer about four times. The recording will continue for three seconds.  At  the  end  of the  recording,  the  Command  Window  will  show End  of recording” . The program will save the first 8192 samples of your audio signal to the current directory of the computer as a MATLAB file audio.mat’ , which can be opened using MATLAB SPTool.

oRename the file audio.mat’ as ‘a.mat’ to indicate the recording of your sound ‘a’ .

Repeat the above procedure to record your sounds ‘b’, ‘c’ and ‘d’


Identify the characteristics of the above four sound signals in the time domain and frequency

domain using MATLAB SPTool. Please note the number of samples for FFT (nfft) used to obtain the spectrum of a signal is 8192, rather than 1024.

The requirements for this task are listed below.