Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 7

Lab Assignment#5

CIIT(ATD)

ABBOTTABAD
Lab Assignment # 05

Subject:
Signals & Systems (Lab-5)

Submitted By:
Naveed Mazhar FA09-BEE-143

Submitted To:
Maam Atiqa Kayani

Date: April 14, 2011

Lab Assignment#5

CIIT(ATD)

Q#1
n=-10:1:10; x=[zeros(1,10) .5 2 zeros(1,9) ]; h=[zeros(1,10) ones(1,3) zeros(1,8)]; subplot(1 ,3, 1); title('x[n] signal'); stem(n,x); xlabel('n-axis'); ylabel('x[n]-axis'); subplot(1 ,3, 2); stem(n,h); title('h[n] signal'); xlabel('n-axis'); ylabel('h[n]-axis'); c=conv(x,h); v=(length(x)+length(h)-2)/2; t=-v:v; subplot(1 ,3, 3); stem(t,c); title('convolution signal'); xlabel('t-axis'); ylabel('c-axis');

Lab Assignment#5

3
h[n] signal

CIIT(ATD)
convolution signal 2.5

2 1.8 1.6 1.4 1.2 h[n]-axis x[n]-axis 1 0.8 0.6 0.4 0.2 0 -10 0 n-axis 10

1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 -10 0 n-axis 10 c-axis

1.5

0.5

0 -20

0 t-axis

20

Q#2
%Part[1]%
n=-10:1:10; u=[zeros(1,10) ones(1,11)]; x1=u; h1=(0.5.^n).*u; y1=conv(x1,h1); l=(length(x1)+length(h1)-2)/2; m1=-l:1:l; figure(1); subplot(3,1,1); stem(n,x1); xlabel('n-axis');ylabel('x[n]-axis');title('x[n]=u[n]');grid on; subplot(3,1,2); stem(n,h1); xlabel('n-axis');ylabel('h[n]-axis');title('h[n]=u[n](0.5^n)');grid on; subplot(3,1,3); stem(m1,y1);

Lab Assignment#5

CIIT(ATD)

xlabel('n-axis');ylabel('y[n]-axis');title('y[n]=conv(x[n],h[n])');grid on;
x[n]= u[n] 1 x[n]-axis 0.5 0 -10

-5

0 n-axis h[n]= u[n](0.5n)

10

h[n]-axis

1 0.5 0 -10 -5 0 n-axis y[n]= conv(x[n],h[n]) 5 10

2 y[n]-axis 1 0 -20

-15

-10

-5

0 n-axis

10

15

20

%Part[2]%
x2=u; u2=[ones(1,10) zeros(1,11)]; h2=(5.^n).*u2; y2=conv(x2,h2); l=(length(x2)+length(h2)-2)/2; m2=-l:1:l; figure(2); subplot(3,1,1); stem(n,x2); xlabel('n-axis');ylabel('x[n]-axis');title('x[n]=u[n]');grid on; subplot(3,1,2); stem(n,h2); xlabel('n-axis');ylabel('h[n]-axis');title('h[n]=u[-n-1](5^n)');grid on; subplot(3,1,3); stem(m2,y2); xlabel('n-axis');ylabel('y[n]-axis');title('y[n]=conv(x[n],h[n])');grid on;

Lab Assignment#5

5
x[n]= u[n]

CIIT(ATD)

1 x[n]-axis 0.5 0 -10

-5

0 n-axis h[n]= u[-n-1](5n)

10

h[n]-axis

0.2 0.1 0 -10 -5 0 n-axis y[n]= conv(x[n],h[n]) 5 10

0.4 y[n]-axis 0.2 0 -20

-15

-10

-5

0 n-axis

10

15

20

%Part[3]%
u3=[zeros(1,14) ones(1,7)]; x3=u3; h3=(2.^n).*u2; y3=conv(x3,h3); l=(length(x3)+length(h3)-2)/2; m3=-l:1:l; figure(3); subplot(3,1,1); stem(n,x3); xlabel('n-axis');ylabel('x[n]-axis');title('x[n]=u[n-4]');grid on; subplot(3,1,2); stem(n,h3); xlabel('n-axis');ylabel('h[n]-axis');title('h[n]=u[-n-1](2^n)');grid on; subplot(3,1,3); stem(m3,y3); xlabel('n-axis');ylabel('y[n]-axis');title('y[n]=conv(x[n],h[n])');grid on;

Lab Assignment#5

6
x[n]= u[n-4]

CIIT(ATD)

1 x[n]-axis 0.5 0 -10

-5

0 n-axis h[n]= u[-n-1](2n)

10

h[n]-axis

0.5

0 -10

-5

0 n-axis y[n]= conv(x[n],h[n])

10

1 y[n]-axis 0.5 0 -20

-15

-10

-5

0 n-axis

10

15

20

%Part[4]%
u4=[zeros(1,20) 1]; x4=u-u4; u5=[ones(1,11) zeros(1,10)]; h4=.5*(2.^n).*u5; y4=conv(x4,h4); l=(length(x4)+length(h4)-2)/2; m4=-l:1:l; figure(4); subplot(3,1,1); stem(n,x4); xlabel('n-axis');ylabel('x[n]-axis');title('x[n]=u[n]-u[n-10]');grid on; subplot(3,1,2); stem(n,h4); xlabel('n-axis');ylabel('h[n]-axis');title('h[n]=u[-n](2^n)(0.5)');grid on; subplot(3,1,3); stem(m4,y4);

Lab Assignment#5

CIIT(ATD)

xlabel('n-axis');ylabel('y[n]-axis');title('y[n]=conv(x[n],h[n])');grid on;
x[n]= u[n]-u[n-10] 1 x[n]-axis 0.5 0 -10

-5

0 n-axis h[n]= u[-n](2n)(0.5)

10

h[n]-axis

0.5

0 -10

-5

0 n-axis y[n]= conv(x[n],h[n])

10

1 y[n]-axis 0.5 0 -20

-15

-10

-5

0 n-axis

10

15

20

You might also like