5
VINEET CHATURVEDI LAB : 4 Q.l. Perform the linear convolution to the following pair of sequences: ( a) h( n )=(−2) n for 2 ≤n≤ 10 x ( n)=e n for2 ≤n≤ 20 Sol: function[y,n]=conv_m(x1,n1,x2,n2) %n1 and n2 are ranges of x[n] and h[n] n = min(n1)+min(n2):max(n1)+max(n2); y = conv (x1, x2); n1= -1:10; h= (-2).^n1; n2= -2:20; x= exp(-n2); [y,n]=conv_new(x,n1,h,n2); stem(n,y) 1(a) ( b) h( n )=3 n cos (πn / 3) u ( n)∧x( n )=2 for 3 ≤n≤ 20 131402

LAB4

Embed Size (px)

DESCRIPTION

labb4

Citation preview

Page 1: LAB4

VINEET CHATURVEDI

LAB : 4

Q.l. Perform the linear convolution to the following pair of sequences:

(a)h(n)=(−2)n for−2≤n≤10

x (n)=e−n for−2≤n≤20

Sol:function[y,n]=conv_m(x1,n1,x2,n2) %n1 and n2 are ranges of x[n] and h[n]n = min(n1)+min(n2):max(n1)+max(n2);y = conv (x1, x2);

n1= -1:10;h= (-2).^n1; n2= -2:20;x= exp(-n2); [y,n]=conv_new(x,n1,h,n2); stem(n,y) 1(a)

(b)h(n)=3n cos(π n/3)u(n)∧x (n)=2 for−3≤n≤20Sol:n1= 0:10; h= (3.^n1).*cos((pi.*n1)/3); n2= -3:20;x= 2+(0*n2); [y,n]=conv_new(h,n1,x,n2); stem(n,y)

131402

Page 2: LAB4

VINEET CHATURVEDI

1(b)

Q.2. Linear convolution follow Associative, Distributive and Identity properties as: (a) Associative Property

[ x1(n)∗x2(n)]∗x3(n)=x1(n)∗[ x2(n)∗x3 (n)]

(b) Distributive Property

[ x1(n)+x2 (n)]∗x 3(n)=x 1(n)∗x 3(n)+x2(n)∗x3 (n)

(c) Identity Property

x (n)∗δ(n−n0)=x (n−n0)

Using the following three sequences, verify the above properties.

x1(n)=n[u(n+10)−u(n−20)]x2 (n)=cos (0.1πn)[u(n)−u (n−30)]x3 (n)=¿

Sol: Associative Property:(a) n1= -10:20;n2= 0:30;n3= -5:10;x1=n1;x2=cos(0.1*pi*n2);x3=1.2.^n3; [y4,n4]=conv_new(x1,n1,x2,n2);[y5,n5]=conv_new(y4,n4,x3,n3);subplot(121);stem(n5,y5) [y6,n6]=conv_new(x2,n2,x3,n3);[y7,n7]=conv_new(y6,n6,x1,n1);subplot(122);stem(n7,y7)

131402

Page 3: LAB4

VINEET CHATURVEDI

2(a)

Distributive Property:

n1=-11:21;x1=n1.*(mystep(-10,-11,21)-mystep(20,-11,21));n2=0:30;x2=cos(0.1*pi.*n2).*(mystep(0,0,30)-mystep(30,0,30));n3=-5:10;

x3=(1.2.^n3).*(mystep(-5,-5,10)-mystep(10,-5,10));[y4,n4]=sigadd(x1,n1,x2,n2);[y5,n5]=conv_new(y4,n4,x3,n3);subplot(121);stem(n5,y5), [y6,n6]=conv_new(x1,n1,x3,n3);[y7,n7]=conv_new(x2,n2,x3,n3);[y8,n8]=sigadd(y6,n6,y7,n7);subplot(122);

stem(n8,y8),

131402

Page 4: LAB4

VINEET CHATURVEDI

Identity Property:

n1=-10:20;x1=n1.*(mystep(-10,-10,20)-mystep(20,-10,20));[y2,n2]=impulse(5,-10,20);[y3,n3]=conv_new(x1,n1,1*y2,n1);subplot(121)stem(n3,y3),

[y5,n5]=sigshift(x1,n1,5);subplot(122)stem(n5,y5)

2(c)

131402