LAB-3
TITLE-IMPULSE RESPONSE OF THE SYSTEM.
THEORY:
CONV- Convolution and polynomial multiplication.
C = CONV(A, B) convolves vectors A and B. The resulting
vector is length LENGTH(A)+LENGTH(B)-1.
If A and B are vectors of polynomial coefficients, convolving
them is equivalent to multiplying the two polynomials.
LENGTH- Length of vector.
LENGTH(X) returns the length of vector X. It is equivalent
to MAX(SIZE(X)) for non-empty arrays and 0 for empty ones.
1. x[n]=[1 1 2 -1]
h[n]=[1 1 1 1]
Find Y[n]
CODE:
x=[1 1 2 -1]
h=[1 1 1 1]
n=0:2:6
subplot(3,1,1)
stem(n,x)
title('impulse response of x')
subplot(3,1,2)
stem(n,h)
title('impulse response of h')
y=conv(x,h)
l1=length(x)
l2=length(h)
N=l1+l2-1
n=0:1:N-1
subplot(3,1,3)
stem(n,y)
title('convolution impulse response')
1
impulse response of x
2
-2
0 1 2 3 4 5 6
impulse response of h
1
0.5
0
0 1 2 3 4 5 6
convolution impulse response
5
-5
0 1 2 3 4 5 6
Figure-1 Impulse respose .
2. x(n)=[1 1 1 1]
h(n)=2^n [n=4]
Find y(n).
CODE:
x=[1 1 1 1]
n=1:1:4
h=power(2,n)
n=0:2:6
subplot(3,1,1)
stem(n,x)
title('impulse response of x')
subplot(3,1,2)
stem(n,h)
title('impulse response of h')
y=conv(x,h)
l1=length(x)
l2=length(h)
N=l1+l2-1
n=0:1:N-1
subplot(3,1,3)
stem(n,y)
title('convolution impulse response')
2
impulse response of x
1
0.5
0
0 1 2 3 4 5 6
impulse response of h
20
10
0
0 1 2 3 4 5 6
convolution impulse response
40
20
0
0 1 2 3 4 5 6
Figure 2-Impulse response of the system.
CONCLUSION- We are observed and plot the impulse response of the system. We know
that CONV and LENGTH function.