Professional Documents
Culture Documents
ECE515FL - Activity5 (Spectral Analysis)
ECE515FL - Activity5 (Spectral Analysis)
Activity No. 5
Spectral Analysis
I. OBJECTIVES
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-jn
n=-
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.
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