0% found this document useful (0 votes)
24 views9 pages

EXP4 Final

Uploaded by

MOTASIM FAIYAZ
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)
24 views9 pages

EXP4 Final

Uploaded by

MOTASIM FAIYAZ
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/ 9

SUMMER 2023

EEE343L
Digital Signal Processing Laboratory

Lab Report (Software)


Section:01 Group No:05

Experiment no:04
Name of the experiment: Sampling Rate Alteration, Response of LTI
Systems to Arbitrary Inputs: Convolution and Difference Equations

Prepared by:
Name: Munirun Nessa ID: 20321022
All Group members:

Sl. Name ID
1. Phub Gyem 20221037

2. Sakib Sadi 20321052

3. Motasim Faiyaz 20121069

4. Mariya Kibtiya 20321006


Experiment Name ._ Sampling Rate Alteration, Response of LTI Systems to Arbitrary
Inputs: Convolution and Difference Equations

Objective ._
Performing Up Sampling, Down Sampling, Convolution and generating system response from
difference equations using MATLAB. Observe the output.

Software Devices and Requirements ._


MATLAB software

Task-01 ._

Code ._
clc;
clear all;
close all;
nx = 0:3;
x = [2 3 5 -2];
nh1 = -2:1;
h1 = [-1 0 3 4];
nh2 = -1:3;
h2 = [2 3 0 7 1];
al_h = nh1(1) + nh2(1);
ah_h =nh1(end) + nh2(end);
idh=al_h:ah_h;
h=conv(h1,h2);
idmin = idh(1) + nx(1);
idmax =idh(end) + nx(end);
idy=idmin:idmax;
y=conv(x,h);
stem(idy,y),xlabel('index'),ylabel('y(n)')
Output ._
Task-02 ._

y(n) = 0.6𝑦 (𝑛 − 1) − 0.08𝑦 (𝑛 − 2) + 𝑥(𝑛)


y(n) − 0.6𝑦 (𝑛 − 1) + 0.08𝑦 (𝑛 − 2) = 𝑥(𝑛)
Code ._
clc;
clear all
close all
a=[1 -0.6 0.08];
b=1;
n=0:20;
%impulse
x=zeros(1,length(n));
id=find(n==0);
x(id)=1;
y=filter(b,a,x);
subplot(121),stem(n,y),legend('impulse response');
%step
x=zeros(1,length(n));
id=find(n>=0);
x(id)=1;
y=filter(b,a,x);
subplot(122),stem(n,y),legend('step response');

Output ._
Task-03 ._

Detailed Calculation ._

y(n) - 3y(n-1)-4y(n-2) = x(n)+2x(n-1)


Input components of x(1)→0
y(n)-3y(n-1)-4y(n-2) = 0
𝑛
Let, y(n) = 𝝀
𝑛 𝑛−1 𝑛−2
So, 𝝀 - 3𝝀 - 9𝝀 =0
𝑛−2 2
⇒𝝀 ( 𝝀 - 3𝝀 - 4 ) = 0
2
⇒ 𝝀 - 3𝝀 - 4 = 0
So , 𝝀 = 4 , -1

𝑛 𝑛
Now , 𝑦𝑐(n) = 𝐶14 + 𝐶2(− 1)
𝑛
𝑦𝑝(n) = k×n× 4 u(n)
And , y(n) = 𝑦𝑐(n) + 𝑦𝑝(n)..........................(i)
Again , y(n)-3y(n-1) -4y(n-2)=x(n)+2x(n-1)
𝑛 𝑛−1 𝑛−2 𝑛 𝑛−1
⇒ k×n×4 u(n) - 3×k(n-1)4 × u(n-1)-4×k(n-2)×4 ×u(n-2) = 4 ×u(n) + 2× 4 ×u(n-1)

When n = 2
2 2−1 2−2 2 2−1
k×2×4 u(2) - 3×k(2-1)4 × u(2-1)-4×k(2-2)×4 ×u(2-2) = 4 ×u(2) + 2× 4 ×u(2-1)
2 1 2 1
⇒ k ( 2× 4 ×u(2) - 3× 1× 4 ×u(1)-0 = 4 ×u(2) + 2× 4 ×u(1)
24 6
⇒k= 20
= 5

When n = 0
0 0 6 0
(i)⇒ y(0) = 𝐶1× 4 + 𝐶2(− 1) + 5
×0× 4 × 𝑢(0) = 𝐶1+ 𝐶2
Let , y(-1) = y(-2) = 0
So , y(0)-3y(-1)-4y(-2)=x(0)+2x(-1) [x(n)=u(n)]
⇒y(0)= 1+0 = 1
So , 𝐶1+ 𝐶2 =1 …………………………………………..(ii)

When n=1
y(1) -3y(0) - 4y(-1) = x(1) +2x(0)
⇒y(1) - 3×1 -4×0 = 0×2×1
⇒y(1) = 2+3 = 5
1 1
⇒ 𝐶1× 4 + 𝐶2(− 1) = 5 ………………………………..(iii)

(ii) , (iii) 𝐶1 = 1.2 𝐶2 = 0.2


𝑛 𝑛
y(n) = 1.2× 4 + 0.2× (− 1)
Code ._
clc;
clear all
close all
h = [];
n = 0:10;
for i=1:length(n)
hn = ((-0.2)*(-1).^i+(1.2)*(4).^i);
h = [h hn];
end
m=0:10;
%step
x=zeros(1,length(n));
id=find(m>=0);
x(id)=1;
idy=m(1) + n(1):m(end) + n(end);
y=conv(x,h);
subplot(211),stem(idy,y),legend('step response of the system'),xlabel('index'),ylabel('h(n)');
%sine
m1=-10:9;
x=0.5*sin(2*pi*0.05*m1);
idy=m1(1) + n(1):m1(end) + n(end);
y=conv(x,h);
subplot(212),stem(idy,y),legend('sin response of the system'),xlabel('index'),ylabel('h(n)');
Output ._

Discussion ._
In this study, MATLAB was utilised. Use difference equations to do upsampling, downsampling,
convolution, and system response. In order to observe the step, impulse, and sinusoidal responses
of various systems, we also employed MATLAB. Despite several challenges, we were able to
complete the experiment successfully. In addition, we occasionally had difficulties with
MATLAB that required us to restart the programme. The experiment was successful other from
that.

You might also like