Digital Signal Processing

Part 3

Discrete-Time Signals & Systems

Case Studies

S R Taghizadeh

January 2000

Introduction

Matlab and its applications in analysis of continuous-time signals and systems has been discussed in part 1 and 2 of this series of practical manuals. The purpose of part 3 is to discuss the way Matlab is used in analysis of discrete-time signals and systems. Each section provides a series of worked examples followed by a number of investigative problems. You are required to perform each of the worked examples in order to get familiar to the concept of Matlab environment and its important functions. In order to test your understanding of the concept of discrete-time signals & systems analysis, you are required to complete as many of the investigation / case study problems as possible. The areas covered are designed to enforce some of the topics covered in the formal lecture classes. These are:

q

Signal Generation and Presentation

q

Discrete Fourier Transform

q

Spectral analysis

q

Autocorrelation and Cross correlation

q

Time delay estimation

Digital Signal Processing Case Study

Copyright-ãS.R.Taghizadeh

2

Signal Generation and Manipulation

Sinusoidal Signal Generation

Consider generating 64 samples of a sinusoidal signal of frequency 1KHz, with a sampling frequency of 8KHz.

A sampled sinusoid may be written as:

x(n) = A sin( 2p

f

n + J)

fs

where f is the signal frequency, fs is the sampling frequency, q is the phase and A is the amplitude of the signal. The program and its output is shown below: % Program: W2E1b.m

% Generating 64 samples of x(t)=sin(2*pi*f*t) with a

% Frequency of 1KHz, and sampling frequency of 8KHz.

N=64;

% Define Number of samples

n=0:N-1;

% Define vector n=0,1,2,3,...62,63

f=1000;

% Define the frequency

fs=8000;

% Define the sampling frequency

x=sin(2*pi*(f/fs)*n); % Generate x(t)

plot(n,x);

% Plot x(t) vs. t

grid;

title('Sinewave [f=1KHz, fs=8KHz]');

xlabel('Sample Number');

ylabel('Amplitude');

Sinewave [f=1KHz, fs=8KHz]

1

0.8

0.6

Am

plitude

0.4

0.2

0

-0.2

-0.4

-0.6

-0.8

-1

0

10

20

Digital Signal Processing Case Study

Copyright-ãS.R.Taghizadeh

30

40

Sample Number

50

60

70

3

Note that there are 64 samples with sampling frequency of 8000Hz or sampling time of 0.125 mS (i.e. 1/8000). Hence the record length of the signal is 64x0.125=8mS. There are exactly 8 cycles of sinewave, indicating that the period of one cycle is 1mS which means that the signal frequency is 1KHz.

Task: Generate the following signals

(i)

64 Samples of a cosine wave of frequency 25Hz , sampling frequency 400Hz, amplitude of 1.5 volts and phase =0.

(ii)

The same signal as in (i) but with a phase angle of p/4 (i.e. 45o).

Exercise 2: Exponential Signal Generation

Generating the signal x(t ) = e -0.1t

for t = 0 to 40mS in steps of 0.1mS

% Program W2E2.m

% Generating the signal x(t)=exp(-0.1t)

t=0:0.1:40;

x=exp(-0.1*t);

plot(t,x);

grid;

title('Exponential Signal');

xlabel('Time [mS]');

ylabel('Amplitude');

And the output is:

Exponential Signal

1

0.9

0.8

Ap d

m litu e

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0

0

5

10

15

Digital Signal Processing Case Study

Copyright-ãS.R.Taghizadeh

20

Time [mS]

25

30

35

40

4

Task: Generate the signal: x(t ) = e -0.1t sin(0.6t ) for t = 0 to 40ms in steps of 0.1 Sec

Exercise 3: Unit Impulse Signal Generation

An impulse is defined as follows:

n=0

ì1

d ( n) = í

î0 elsewhere

1

t

The following Matlab program generates a unit impulse signal. % Program W2E3.m

% Generating 64 Samples of a unit impulse signal

N=64;

% Define the number of samples

n=-(N/2):((N/2)-1);

% Define a vector of sample numbers

x=zeros(1,N);

% Define a vector of zeros

x((N/2)+1)=1.0;

% Make the first sample to be 1...