You are on page 1of 3

ECE 515 FL

Digital Signal Processing Laboratory Activity 5: Spectral Analysis

Activity No. 5
Spectral Analysis

I. OBJECTIVES

At the end of the activity, the student must be able to:


1. Demonstrate concepts related to the spectra of signals.
2. Perform spectral analysis using Discrete-Time Fourier Transform.

II. BACKGROUND / LABORATORY ACTIVITY

The spectrum of a signal defines its frequency content as well as the magnitude and phase
of the frequency components. The analysis of the spectra of as signal is essential for
characterization and processing.
The frequency spectrum of a digital signal with samples x[n] can be determined using
Discrete-Time Fourier Transform (DTFT) denoted as X() = DTFT {x[n]} where X() is the
frequency spectrum of x[n]. It is evaluated as

X() =  x[n]e-jn

n=-

where:  - digital frequency, in radians


The digital frequency  is linearly related to the analog frequency f as =2πf/Fs. Since x[n] is a
sampled signal, its frequency content is limited to Fs/2 Hz. Correspondingly, the digital frequency
 is limited to π.
The frequency spectrum X() is generally complex-valued and expressed in polar form as
X()=|X()|  X() where |X()| is the magnitude spectrum which represents the magnitude of
the frequency component while  X() is the phase spectrum which represents the phase of the
frequency components.

SLU ECE 1
ECE 515 FL
Digital Signal Processing Laboratory Activity 5: Spectral Analysis

Example 1:
Generate the samples of x(t)=2sin(500πt)+3cos(2000πt) for 1 second duration using a
sampling rate Fs=8000Hz and then plot the magnitude and phase spectra.
Fs=8000;
t=0:1/Fs:1; //Generate the sampling instants
xn=2*sin(500*%pi*t)+3*cos(2000*%pi*t); //Generate samples of x[n]
k=length(xn); //k - no. of samples in x[n]
//Evaluate X(W) for -%pi≤W≤ %pi
W=-%pi:0.001:%pi; //Generate values of W
f=W*Fs/2/%pi; //Generate values of f
XW=zeros(W); //Initialize X(W)
for n=1:k
XW=XW+xn(n)*exp(-%i* W*(n-1));.
end;
XW=XW/(length(xn)/2); //Correct the magnitude values
//Plot the two-sided magnitude spectrum
clf; subplot(2,1,1); plot2d(f,abs(XW)); xgrid();
//Plot the one-sided magnitude spectrum (positive frequencies only)
f=f(length(W-1)/2:length(W)); XW=XW(length(W-1)/2:length(W));
clf; subplot(2,1,1); plot2d(f,abs(XW)); xgrid();

The plot of the magnitude spectrum show that the signal has two significant frequency
components which are 250Hz and 1000Hz with amplitudes of 2 and 3, respectively.

III. LABORATORY EXERCISE

1. DTMF Decoding
Load the audio file DTMF.wav into Scilab and then plot the samples of the DTMF signal.
Observe that it contains a series of dual-tone segments.

SLU ECE 2
ECE 515 FL
Digital Signal Processing Laboratory Activity 5: Spectral Analysis

(a) Separate the first dual-tone segment and plot its magnitude spectrum..
What are the frequencies in the first dual-tone segment? ____________________________
What is the dialled number corresponding to the first dual-tone segment? ______________
(b) Repeat the spectral analysis done in (a) on all the other dual-tone segments of the DTMF
signal.
What are the dialled numbers in the DTMF signal? ________________________________

SLU ECE 3

You might also like