0% found this document useful (0 votes)
42 views

Task 1: Waqar Azeem Sp10-Bet-086 Usman Jalil Paracha Fa11-BET-105

This document contains 5 tasks involving the convolution of sequences. In each task, two sequences x[n] and h[n] are defined and convolved to produce the output sequence y[n]. Plots of x[n], h[n], and y[n] are displayed for each task to illustrate the results of the convolution.

Uploaded by

IAmAbdullah
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Task 1: Waqar Azeem Sp10-Bet-086 Usman Jalil Paracha Fa11-BET-105

This document contains 5 tasks involving the convolution of sequences. In each task, two sequences x[n] and h[n] are defined and convolved to produce the output sequence y[n]. Plots of x[n], h[n], and y[n] are displayed for each task to illustrate the results of the convolution.

Uploaded by

IAmAbdullah
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Waqar Azeem Sp10-BET-086

Fa11-BET-105

Usman Jalil Paracha

Task 1
n=-6:6;
k=(1/3).^-n;
x=k.*(n<=-1);
h=[0 0 0 0 0 0 0 1 1 1 1 1 1];
subplot(3,1,1)
stem(n,x,'fill','linewidth',2),grid on
legend('x[n]')
axis([-6 6 0 1])
subplot(3,1,2)
stem(n,h,'fill','linewidth',2),grid on
legend('h[n]')
axis([-6 6 0 1])
y=conv(h,x);
subplot(3,1,3)
stem(-12:12,y,'fill','linewidth',2),grid on
legend('y[n]=[n]*h[n]')
axis([-6 6 0 1])

1
x[n]
0.5
0
-6

-4

-2

1
h[n]
0.5
0
-6

-4

-2

1
y[n]=[n]*h[n]
0.5
0
-6

-4

-2

Waqar Azeem Sp10-BET-086


Fa11-BET-105

Usman Jalil Paracha

LAB Task 2
By Conv:
n=-6:10;
x=[0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0];
a=(1.5.^n);
b=(n>=0)&(n<=6);
h=k.*b;
subplot(3,1,1)
stem(n,x,'fill','linewidth',2),grid on
legend('x[n]')
subplot(3,1,2)
stem(n,h,'fill','linewidth',2),grid on
legend('h[n]')
y=conv(h,x);
subplot(3,1,3)
stem(-12:20,y,'fill','linewidth',2),grid on
legend('y[n]=[n]*h[n]');
axis([-12 10 0 30])
1
x[n]
0.5
0
-6

-4

-2

10

15
h[n]

10
5
0
-6

-4

-2

10

30
y[n]=[n]*h[n]

20
10
0
-12

-10

-8

-6

-4

-2

10

Waqar Azeem Sp10-BET-086


Fa11-BET-105

Usman Jalil Paracha

TASK 3
By Conv:

n=-6:6;
h=[0 0 0 0 0 0 1 1 1 1 1 1 1];
x=2.^n .*(n<=0);
subplot(3,1,1)
stem(n,x,'fill','linewidth',2),grid on
xlim([-6 6])
legend('x[n]')
subplot(3,1,2)
stem(n,h,'fill','linewidth',2),grid on
xlim([-6 6])
legend('h[n]')
y=conv(h,x);
subplot(3,1,3)
n=-12:12;
stem(n,y,'fill','linewidth',2),grid on
legend('y[n]=[n]*h[n]')
xlim([-12 12])

1
x[n]
0.5
0
-6

-4

-2

1
h[n]
0.5
0
-6

-4

-2

2
y[n]=[n]*h[n]
1
0

-10

-5

10

Waqar Azeem Sp10-BET-086


Fa11-BET-105

Usman Jalil Paracha

TASK 4
By Conv:
n=-2:6;
h=[0 0 1 1 1 1 0 0 0];
x=[0 0 1 0 1 0 0 0 0];
subplot(3,1,1)
stem(n,x,'fill','linewidth',2),grid on
legend('x[n]')
subplot(3,1,2)
stem(n,h,'fill','linewidth',2),grid on
legend('h[n]')
y=conv(h,x);
subplot(3,1,3)
stem(-4:12,y,'fill','linewidth',2),grid on
legend('y[n]=[n]*h[n]')

1
x[n]
0.5
0
-2

-1

1
h[n]
0.5
0
-2

-1

2
y[n]=[n]*h[n]
1
0
-4

-2

10

12

Waqar Azeem Sp10-BET-086


Fa11-BET-105

Usman Jalil Paracha

TASK 5 (a)
By Conv:
n=0:6;
h=ones(size(n));
x=ones(size(n));
subplot(3,1,1)
stem(n,x,'fill','linewidth',2)
legend('x[n]')
subplot(3,1,2)
stem(n,h,'fill','linewidth',2)
legend('h[n]')
y=conv(h,x);
subplot(3,1,3)
n=0:12
stem(n,y,'fill','linewidth',2)
legend('y[n]')

1
x[n]
0.5
0

1
h[n]
0.5
0

10
y[n]
5
0

10

12

Waqar Azeem Sp10-BET-086


Fa11-BET-105

Usman Jalil Paracha

TASK 5(b)
By Conv:
n=0:5;
h=((3/4).^n).*(n>=0);
x=[0 0 0 0 3 0];
subplot(3,1,1)
stem(n,x,'fill','linewidth',2)
legend('x[n]')
subplot(3,1,2)
stem(n,h,'fill','linewidth',2)
legend('h[n]')
y=conv(h,x);
subplot(3,1,3)
n=0:10;
stem(n,y,'fill','linewidth',2)
legend('y[n]')
3
x[n]

2
1
0

0.5

1.5

2.5

3.5

4.5

1
h[n]
0.5
0

0.5

1.5

2.5

3.5

4.5

3
y[n]

2
1
0

10

You might also like