You are on page 1of 3

Signal and System Roll NO: 2018-EE-14

LAB NO#08
Task 1:

Task 2:
x = [1 2 3 -1 ]
h = [1 2 1 -1 ]
nh= 0:3
nx= 0:3
yh = nx(1)+nh(1) : nx(end)+nh(end)
y=conv(h,x);
stem(yh,y);
Result:

Task 3:
x = [0 0 1 0 2 0 0 -1 0 ]
h = [0 0 1 0.8 0.6 0 0 0 0]
nh= -3:5
nx= -4:4
yh = nx(1)+nh(1) : nx(end)+nh(end)
y=conv(h,x);
stem(yh,y);
Signal and System Roll NO: 2018-EE-14

Result:

Task 4:
clc
x = input ('Define x Signal :');
h = input ('Define h Signal :');
nh= input ('Define h limits :');
nx= input ('Define x limits :');
conv_m(x,h,nx,nh);

function [Y,ny] = conv_m (x,h,nx,nh)


yh = nx(1)+nh(1) : nx(end)+nh(end)
y=conv(h,x);
stem(yh,y);

endfunction
Result :
define x Signal :[ 1 2 3 4 5]
Define h Signal :[ 6 7 8 9 0]
Define h limits :0:4
Define x limits :0:4

Task 5:
Signal and System Roll NO: 2018-EE-14

close all
clear all
x=input('Enter x: ') % input x in the form [1,2,3,4,5]
h=input('Enter h: ')
m=length(x);
n=length(h);
X=[x,zeros(1,n)]; % padding of n zeros
H=[h,zeros(1,m)]; % padding of m zeros
for i=1:n+m-1
Y(i)=0;
for j=1:i
Y(i)=Y(i)+X(j)*H(i-j+1);
end
end
Y
stem(Y);
ylabel('Y[n]');
xlabel('----->n');
title('Convolution of Two Signals without conv function');
Result:

Conclusion:
In this lab we plot graphs applying different frequencies and values also using Different
Commands……………………

You might also like