0% found this document useful (0 votes)
11 views5 pages

Lab 6

The document outlines a lab focused on discrete time systems in the frequency domain, covering topics such as frequency response, steady state response, and methods to analyze LTI systems using MATLAB. It includes detailed explanations of mathematical concepts, example programs for calculating frequency responses, and tasks for students to implement in MATLAB. The lab tasks require students to write code to analyze specific LTI systems and their responses.

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)
11 views5 pages

Lab 6

The document outlines a lab focused on discrete time systems in the frequency domain, covering topics such as frequency response, steady state response, and methods to analyze LTI systems using MATLAB. It includes detailed explanations of mathematical concepts, example programs for calculating frequency responses, and tasks for students to implement in MATLAB. The lab tasks require students to write code to analyze specific LTI systems and their responses.

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/ 5

Lab # 06 Discrete Time Systems in Frequency Domain

C O N T E N T S:
Frequency Response of LTI System: .......................................................................................... 2
Steady State Response of LTI System: ....................................................................................... 2
Frequency Response by using Difference Equation ................................................................... 3
LAB TASKS: .............................................................................................................................. 5

1
Frequency Response of LTI System:
The discrete time Fourier Transform of an impulse response of LTI system is called the Frequency
Response of an LTI system and is denoted by

𝐻(𝑒 𝑗𝑤 ) = ∑∞
𝑛=−∞ ℎ(𝑛)𝑒
−𝑗𝑤𝑛
... (1)
We can represent the system by

𝑥(𝑛) = 𝑒 𝑗𝑤0 𝑛 𝐻(𝑒 𝑗𝑤 ) 𝑦(𝑛) = 𝐻(𝑒 𝑗𝑤0 ) × 𝑒 𝑗𝑤0 𝑛

Hence the output sequence is the input exponential sequence modified by the response of the system at the
frequency 𝑤0 .
In general, the frequency response 𝐻(𝑒 𝑗𝑤 ) is a complex function of 𝑤. The magnitude |𝐻(𝑒 𝑗𝑤 )| of 𝐻(𝑒 𝑗𝑤 ) is
called the magnitude response function and the angle ∠𝐻(𝑒 𝑗𝑤 ) is called the phase response function.

Program 1:
Determine the frequency response 𝐻(𝑒 𝑗𝑤 ) of a system characterized by
ℎ(𝑛) = (0.9)𝑛 𝑢(𝑛)
Plot the magnitude and phase response.
Using Eq. 1, we find that
1
𝐻(𝑒 𝑗𝑤 ) = ... (2)
1−0.9𝑒 −𝑗𝑤
>> w=[0:pi/500:pi]; % just to make 500 samples of pi
>> H=1./(1-0.9*exp(-j*w));
>> magH=abs(H); >> angH=angle(H);
>> subplot(211) >> plot(w,magH)
>> subplot(212) >> plot(w,angH)

Steady State Response of LTI System:


Let 𝑥(𝑛) = 𝐴𝑐𝑜𝑠(𝑤0 𝑛 + 𝜃0 ) be an input to an LTI system ℎ(𝑛). The response of the system will be another
sinusoid of the same frequency 𝑤0 , with amplitude gained by |𝐻(𝑒 𝑗𝑤0 )| and the phase shifted by ∠𝐻(𝑒 𝑗𝑤0 )
and is given by
𝑦𝑠𝑠 (𝑛) = 𝐴|𝐻(𝑒 𝑗𝑤0 )|cos(𝑤0 𝑛 + 𝜃0 + ∠𝐻(𝑒 𝑗𝑤0 ) )
This response is called the steady-state response and is denoted by 𝑦𝑠𝑠 (𝑛).

Program 2:
Determine the steady state response 𝑦𝑠𝑠 (𝑛) of the system characterized by
ℎ(𝑛) = (0.9)𝑛 𝑢(𝑛) 0 ≤𝑛 ≤ 10
when the input to the system is
𝑥 (𝑛) = 3cos(0.5𝜋𝑛 + 60𝑜 )
From Program 1 we know that for this system, the frequency response is

2
1
𝐻(𝑒 𝑗𝑤 ) =
1 − 0.9𝑒 −𝑗𝑤
>> n=0:10; >> w0=0.5*pi;
>> theta=60; >> A=3;
>> H0=1./(1-0.9*exp(-j*w0));
>> magH0=abs(H0);
>> angH0=angle(H0);
>> yss=A*magH0*cos(w0*n+ theta + angH0);
>> plot(n,yss)

Alternate Method
From Eq. 2, we find the difference equation parameters and then use filter command to find the output of the
system.
>> b=[1]; >> a=[1,-0.9];
>> n=0:10;
>> x=3*cos(0.5*pi*n +60);
>> yss=filter(b,a,x);
>> plot(n,yss)

Frequency Response by using Difference Equation


When an LTI system is represented by the difference equation
𝑁 𝑀

𝑦(𝑛) + ∑ 𝑎𝑙 𝑦(𝑛 − 𝑙) = ∑ 𝑏𝑚 𝑥(𝑛 − 𝑚)


𝑙=1 𝑚=0
To evaluate the frequency response, we would need the impulse response h(n). But we can easily obtain 𝐻(𝑒 𝑗𝑤 )
from Eq. 1. We know that when 𝑥(𝑛) = 𝑒 𝑗𝑤𝑛 then y(n) must be 𝐻(𝑒 𝑗𝑤 )𝑒 𝑗𝑤𝑛 . Substituting it in above equation
𝑁 𝑀

𝐻(𝑒 𝑗𝑤 )𝑒 𝑗𝑤𝑛 + ∑ 𝑎𝑙 𝐻(𝑒 𝑗𝑤 )𝑒 𝑗𝑤(𝑛−𝑙) = ∑ 𝑏𝑚 𝑒 𝑗𝑤(𝑛−𝑚)


𝑙=1 𝑚=0
Or
𝑗𝑤 ∑𝑀
𝑚=0 𝑏𝑚 𝑒
−𝑗𝑤𝑚
𝐻(𝑒 )= …. (2)
1+ ∑𝑁
𝑙=1 𝑎𝑙 𝑒
−𝑗𝑤𝑙
This equation can be easily implemented in MATLAB, given the difference equation parameters.
Program 3:
An LTI system is specified by the difference equation
𝑦(𝑛) = 0.8𝑦(𝑛 − 1) + 𝑥(𝑛)
a- Plot frequency response of the system.
b- Plot the steady state response of the system to the input
𝑥(𝑛) = 𝑐𝑜𝑠(0.05𝜋𝑛)𝑢(𝑛) for −100 ≤ 𝑛 ≤ 100
Solution:
a- Using Eq. 2

3
1
𝐻(𝑒 𝑗𝑤 ) =
1−0.8𝑒 −𝑗𝑤

>> w=[0:0.00628:pi]; %pi / 500 = 0.00628 % 500 samples


>> H=1./(1-0.8*exp(-j*w));
>> magH=abs(H);>> angH=angle(H);
>> subplot(221); >> plot(w,magH)
>> subplot(222); >> plot(w,angH)

b-
>> b=[1]; >> a=[1,-0.8];
>> n=0:100;
>> x=cos(0.05*pi*n);
>> y=filter(b,a,x);
>> plot(n,y)

In the above example, the system was characterized by a first-order difference equation. In practice the
difference equations are of large order and hence we need a compact procedure. This can be done using a
simple matrix-vector multiplication. If we evaluate 𝐻(𝑒 𝑗𝑤 ) at k=0,1,…,K equispaced frequencies over [0, 𝜋],
then Eq. 2 will be
∑𝑀 𝑏 𝑒 −𝑗𝑤𝑘 𝑚
𝐻(𝑒 𝑗𝑤𝑘 ) = 𝑚=0𝑁 𝑚 −𝑗𝑤𝑘𝑙 , 𝑘 = 0,1, … , 𝐾
1+ ∑𝑙=1 𝑎𝑙 𝑒
If we let {𝑏𝑚 }, {𝑎𝑙 } (with 𝑎0 = 1) , m=0,1,…,M , l=0,1,…,N and {𝑤𝑘 } be arrays (or row vectors), then the
numerator and denominator of above equations become
𝒃𝑒𝑥𝑝(−𝑗𝒎𝑇 𝒘) 𝑎𝑛𝑑 𝒂𝑒𝑥𝑝(−𝑗𝒍𝑇 𝒘)
This procedure can be implemented in MATLAB to define the frequency response, given the difference
equations parameters.

Program 4:
An LTI system is described by:
𝑦(𝑛) = 0.0181𝑥(𝑛) + 0.0543𝑥(𝑛 − 1) + 0.0543𝑥(𝑛 − 2) + 0.0181𝑥(𝑛 − 3)
+ 1.76𝑦(𝑛 − 1) − 1.1829𝑦(𝑛 − 2) + 0.2781𝑦(𝑛 − 3)

Plot the magnitude and phase response of the system.

>> b = [0.0181,0.0543,0.0543,0.0181];
>> a = [1,-1.76,1.1829,-0.2781];
>> m=0: length(b)-1; >> l=0:length(a)-1;
>> K=500; >> k=0:K;
>> w=[0:0.00628:pi];
>> num=b*exp(-j*m'*w);
>> den=a*exp(-j*l'*w);
>> H=num./den;
>> magH=abs(H); >> angH=angle(H);
>> subplot(211) >> plot(w,magH)
4
>> subplot(212) >> plot(w,angH)

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

Task 1: An LTI system is defined by

ℎ(𝑛) = 𝛿 (−𝑛 + 3) + 𝛿 (−𝑛 + 2) + 𝛿 (𝑛) + 𝛿 (𝑛 − 1) + 𝛿(𝑛 − 2) 𝑓𝑜𝑟 − 5 ≤ 𝑛 ≤ 5

Write MATLAB code to plot the magnitude response and phase response to describe the frequency response of
the system.

Task 2: Let 𝑥(𝑛) = 2𝑠𝑖𝑛(0.3𝜋𝑛) be the input to the LTI system given by

ℎ(𝑛) = 𝑠𝑖𝑛𝑐(0.2𝑛)[𝑢(𝑛 + 10) − 𝑢(𝑛 − 10)] 𝑓𝑜𝑟 − 30 ≤ 𝑛 ≤ 30

Write MATLAB code to detect the steady state response of the system by analyzing the frequency response.

Task 3: An LTI system is specified by the difference equation

𝑥(𝑛) − 𝑥(𝑛 − 1)
𝑦(𝑛) − 𝑦(𝑛 − 1) =
2
a- Write MATLAB code to describe the impulse response of system in frequency domain and plot the
frequency response.
b- Write MATLAB code to detect the steady state response of the system to the input

𝜋
𝑥(𝑛) = 5 + cos(0.5𝜋𝑛 + )
2

You might also like