0% found this document useful (0 votes)
9 views8 pages

Lab 5

The document covers the concepts of Discrete Time Fourier Series (DTFS) and Discrete Time Fourier Transform (DTFT), including their mathematical representations and MATLAB implementations. It provides example programs for calculating the DFS representation of periodic sequences and the DTFT of finite duration sequences. Additionally, it outlines lab tasks for students to apply these concepts in practical scenarios.

Uploaded by

badarqureshi1194
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views8 pages

Lab 5

The document covers the concepts of Discrete Time Fourier Series (DTFS) and Discrete Time Fourier Transform (DTFT), including their mathematical representations and MATLAB implementations. It provides example programs for calculating the DFS representation of periodic sequences and the DTFT of finite duration sequences. Additionally, it outlines lab tasks for students to apply these concepts in practical scenarios.

Uploaded by

badarqureshi1194
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Lab # 05 Discrete Time Signals in Frequency Domain

C O N T E N T S:

Discrete Time Fourier Series (DTFS): ........................................................................................ 2


Discrete Time Fourier Transform (DTFT): ................................................................................ 4
LAB TASKS: .............................................................................................................................. 8

1
Discrete Time Fourier Series (DTFS):
A periodic sequence 𝑥(𝑛) is periodic with a fundamental period of N provided that it satisfies
the condition

𝑥 (𝑛) = 𝑥(𝑛 + 𝑁)

The Fourier series representation for 𝑥(𝑛) consists of N harmonically related exponential functions

𝑒 𝑗2𝜋𝑘𝑛/𝑁 , 𝑘 = 0,1,2, … . 𝑁 − 1

Therefore, a discrete time periodic signal can be expressed as

𝑁−1
𝑗2𝜋𝑘𝑛
𝑥 (𝑛) = ∑ 𝑐𝑘 𝑒 𝑁
𝑘=0

Where 𝑐𝑘 are the discrete Fourier series co-efficients, which are given by,

𝑁−1
𝑗2𝜋𝑘𝑛
𝑐𝑘 = ∑ 𝑥(𝑛) 𝑒 − 𝑁
𝑛=0

In general, 𝑐𝑘 is complex valued periodic sequence with the fundamental period N.

2𝜋
−𝑗
Suppose 𝑊𝑁 = 𝑒 𝑁

The above equation can be written as

𝑁−1

𝑥 (𝑛) = ∑ 𝑐𝑘 𝑊𝑁−𝑛𝑘
𝑘=0

And

𝑁−1

𝑐𝑘 = ∑ 𝑥 (𝑛) 𝑊𝑁𝑛𝑘
𝑛=0

2
From the above equation, it is clear that to compute all Discrete Fourier co-efficients, two nested
for…end loops would be required. This is clearly inefficient in MATLAB. An efficient implementation in MATLAB
would be to use a matrix-vector multiplication. Let 𝒄 and 𝑿 denote the column vectors corresponding to the
primary (one) period of the Fourier series co-efficients and the input sequence respectively. So, we can write
the above equations as

𝑪 = 𝑾𝑵 𝑿

And

1
𝑿= 𝑾 ∗𝑪
𝑁 𝑵
Where the matrix 𝑾𝑵 is given by

𝟏 𝟏 … 𝟏
𝟏 𝑊𝑁1 … 𝑊𝑁𝑁−1
𝑾𝑵 = [𝑊𝑁𝑘𝑛 , 𝑘 ≤𝑁−1 ,𝑛 ≤ 𝑁−1 ]= ⋮ ⋮ ⋱ ⋮
(𝑁−1)2
[𝟏 𝑊𝑁𝑁−1 … 𝑊𝑁 ]

The matrix 𝑾𝑵 is a square matrix and is called DFS matrix.

Program 1:

Find the DFS representation of the periodic sequence given below

𝑥 (𝑛) = {… , 0 , 1,2,3,0,1,2,3,0,1,2,3, … }

>> x=[0,1,2,3];

>> N=4;

>> n=[0:N-1];

>> k=[0:N-1];

>> WN=exp(-j*2*pi/N);
3
>> nk=n'*k;

>> WNnk=WN .^ nk;

>> Ck=x * WNnk

Program 2:

Find the periodic sequence whose DFS co-efficients are

Ck =[6 , -2 + 2j, -2 , -2-2j]

>> Ck=[6,-2+2j,-2,-2-2j];

>> N=4;

>> n=[0:N-1];

>> k=[0:N-1];

>> WN=exp(-j*2*pi/N);

>> nk=n'*k;

>> WNnk=WN .^ (-nk);

>> x=(Ck * WNnk)/N

Discrete Time Fourier Transform (DTFT):


The frequency analysis of discrete time aperiodic finite energy signals involves a Fourier transform of the time
domain signal.

If 𝑥(𝑛) is absolutely summable, that is ∑∞


−∞|𝑥(𝑛)| < ∞, then its DTFT is

𝑋(𝑒 𝑗𝑤 ) = ∑ 𝑥(𝑛)𝑒 −𝑗𝑤𝑛


𝑛=−∞

Where 𝑤 is the real frequency variable. The Fourier Transform representation of a sequence is unique and is
continuous function of 𝑤. The original sequence can be computed from its transform representation by using
the following IDTFT formula

4
1 ∞
𝑥 (𝑛) = ∫ 𝑋(𝑒 𝑗𝑤 ) 𝑒 𝑗𝑤𝑛 𝑑𝑤
2𝜋 −∞

The frequency range of the discrete time signal is unique over the frequency interval of (−𝜋, 𝜋) or, equivalently,
(0,2𝜋). Hence 𝑋(𝑒 𝑗𝑤 ) will be periodic with a period 2𝜋.

If 𝑥(𝑛) is of infinite duration, then MATLAB cannot be used directly to compute 𝑋(𝑒 𝑗𝑤 ) from 𝑥(𝑛). However,
we can use it to evaluate the expression 𝑋(𝑒 𝑗𝑤 ) over (0, 𝜋) frequencies and then plot its magnitude and phase
(or real and imaginary parts).

Program 3:

Determine DTFT of 𝑥(𝑛) = (0.5)𝑛 𝑢(𝑛) at 501 equispaced points between [0, 𝜋]. Plot its magnitude, phase,
real and imaginary parts.

First find 𝑋(𝑒 𝑗𝑤 ) by using the formula, and then determine its different parts.

>> w=[0:0.00628:pi];

>> u=ones(1,501);

>> X=exp(j*w) ./ (exp(j*w) - 0.5*u);

>> magX=abs(X);

>> angX=angle(X);

>> realX=real(X);

>> imagX=imag(X);

>> subplot(221)

>> plot(w,magX);

>> subplot(222)

5
>> plot(w,angX)

>> subplot(223)

>> plot(w,realX)

>> subplot(224)

>> plot(w,imagX)

If x(n) is of finite duration, then MATLAB can be used to compute 𝑋(𝑒 𝑗𝑤 ) numerically at any frequency.

The above approach is to compute the DTFT of x(n) using the definition of DTFT. In addition, the DTFT can also
be implemented, as a matrix-vector multiplication operation.

Suppose x(n) has N samples between 𝑛1 ≤ 𝑛 ≤ 𝑛𝑁 (i.e. not necessarily between [0, N-1]) and we want to
𝜋
evaluate 𝑋(𝑒 𝑗𝑤 ) at 𝑤𝑘 = 𝑘, 𝑘 = 0,1, … , 𝑀 which are (M+1) equispaced frequencies between [0,𝜋]. The
𝑀

DTFT formula can be written as

𝑁
𝜋
−𝑗(𝑀)𝑘𝑛𝑙
𝑋(𝑒 𝑗𝑤𝑘 ) = ∑ 𝑒 𝑥(𝑛𝑙 ) , 𝑘 = 0,1, … , 𝑀
𝑙=1

When {𝑥(𝑛𝑙 )} and {𝑋(𝑒 𝑗𝑤𝑘 )} are arranged as column vector x and X, respectively. So, we can write,

𝑿 = 𝑾𝒙

Where 𝑊 is an (M+1) × N matrix given by

𝜋
−𝑗( )𝑘𝑛𝑙
𝑾= {𝑒 𝑀 ; 𝑛1 ≤ 𝑛 ≤ 𝑛𝑁 , 𝑘 = 0,1, … , 𝑀}

In addition if we arrange {k} and {𝑛𝑙 } as row vectors 𝒌 and 𝒏 respectively then

𝜋 𝑇
𝑿𝑇 = 𝒙𝑇 [𝑒𝑥𝑝(−𝑗 𝒏 𝒌)]
𝑀
6
Note that 𝒏𝑇 𝒌 is an 𝑁 × (𝑀 + 1) matrix.

Using this matrix representation, we can write

>> k=[0:M];

>> n=[n1:n2];

>> X=x*(exp(-j*pi*/M) .^ (n' *k);

Program 4:

Determine the DTFT of the following finite duration sequence 501 equi-spaced frequencies between [0,π].

x(n) = {1,2,3,4,5}

>> x=1:5;

>> n=-1:3;

>> k=0:500;

>> X=x*(exp(-j*pi/500)) .^(n'*k);

>> magX=abs(X); >> angX=angle(X);

>> realX=real(X); >> imagX=imag(X);

>> subplot(221) >> plot(k,magX);

>> subplot(222) >> plot(k,angX);

>> subplot(223) >> plot(k,realX);

>> subplot(224) >> plot(k,imagX);

7
LAB TASKS: [Q-Marks: 10; CLO-1; PLO-4; P-1]

Task 1: Let x(n) be periodic signal with fundamental period N=50, where one period is given by

−0.3𝑛
𝑛𝑒 , 0 ≤ 𝑛 ≤ 25
𝑥 (𝑛) = {
0 , 26 ≤ 𝑛 ≤ 49

Choose DFS representation to represent x(n) in frequency domain.

Task 2: Identify the periodic sequence given by the following DFS coefficients.

Ck = [0,j,-2j,-j] N=4

Task 3: Choose DTFT to represent the following sequence in frequency domain. Also, plot the magnitude and
angle.

𝑥(𝑛) = (𝑛 + 2)(−0.7)𝑛−1 𝑢(𝑛 − 2) 𝑓𝑜𝑟 − 5 ≤ 𝑛 ≤ 5

You might also like