0% found this document useful (0 votes)
6 views

DSP Lab Report 7 Oel

Uploaded by

madnir99
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

DSP Lab Report 7 Oel

Uploaded by

madnir99
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Discrete time systems in

frequency domain
OPEN ENDED LAB

5 / 3 / 24

07
EE-20-A

Muhammad Raza Madni 210401034


Riyan Abdullah 210401013
Lab # 07
Objectives:

Equipment’s:
• Laptop
• MATLAB (software)

Introduction to MATLAB
MATLAB is a high-level programming language that has been used extensively to solve complex
engineering problems.
Task
An LTI system is specified by the difference equation.

1. Write MATLAB code to describe the impulse response of system in frequency domain and plot the
frequency response.
2. Write MATLAB code to detect the steady state response of the system to the input.

Answers:
Following is the MATLAB function code as well as the results.

part i
clc;
clear;
b = [0.5, -0.5]; % input(x) coefficients
a = [1, -1]; % output(y) coefficients

m = 0 : length(b)-1;
l = 0 : length(a)-1;
k = 500; % samples
K = 0 : k;
w = 0: pi/k :pi;
num=b*exp(-1i*m'*w);
den=a*exp(-1i*l'*w);
H=num./den;
magH=abs(H);
angH=angle(H);
subplot(211); plot(w,magH,LineWidth=4); title magnitute ;xlabel w ;ylabel amplitute;legend
magnitute;
subplot(212); plot(w,angH,LineWidth=4); title Phase ;xlabel w ;ylabel amplitute;legend
phase;

figure
plot(H,LineWidth=4); title Impulse(H(exp(-jwn))) ;xlabel n ;ylabel amplitute;legend H;
part ii
%let n be
n = -20:0.1:20;
A = 2;
B = 5;
wo = 0.5*pi;
theta = pi/2;
k = 500;
w = 0:pi/k:wo;
x = B + A*cos(wo*n + theta);
yss = B.*magH(1:length(n)) + A.*magH(1:length(n)).*cos(wo*n+theta+angH(1:length(n)));
anglyss = angle(yss);
magyss = abs(yss);
plot(n,x,LineWidth=4);title x;xlabel n;ylabel amplitute;legend input;

plot(n,yss,LineWidth=4);title yss;xlabel n;ylabel amplitute;legend steady_state;

…the end!

You might also like