Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

COMSATS UNIVERSITY ISLAMABAD

ABBOTTABAD CAMPUS

NAME Shahzad Arif


REG NO. FA19-EPE-109
SECTION 4C
SUBJECT SIGNAL AND SYSTEM
LAB ENGINEER SIR IZHAR KHAN
LAB LAB SESSIONAL 2
DATE MAY 23,2021
COMSATS UNIVERSITY ISLAMABAD
ABBOTTABAD CAMPUS
QUESTION NO 1

Find the output of Discrete Time System having input and impulse response give

X[n]=u[n] and h[n]=u[n]-u[n-10]

Matlab code:
clc;
clear all;
close all;
n=-20:20;
%performing convolution
X=((sign(n+eps)+1)/2);
subplot(311)
stem(n,X,'r')
grid('on')
title('Shahzad Arif FA19 EPE 109___ X[n]')
%plotting impluse response
h=((sign(n+eps)+1)/2)-((sign((n-10)+eps)+1)/2);
subplot(312)
stem(n,h,'b')
grid('on')
title('h[n]--impluse response')
Y=conv(h,X,'same');
figure,
stem(n,Y)
title(' Convolution ')
Xlable('time')
Ylabel('Y[n]=h[n]*X[n]')
subplot(313)
gride('on')
COMSATS UNIVERSITY ISLAMABAD
ABBOTTABAD CAMPUS

You might also like