You are on page 1of 15

# 3.

b
i.
b=[0,0,0,0,0,0,0,0,0,0,1];
a=[1];
[X,W]= freqz(b,a,512,'whole');
freqz(b,a,512,'whole');

ii.
b=[0.27,-0.46,0.27];
a=[1];
[X,W]= freqz(b,a,512,'whole');
freqz(b,a,512,'whole');

iii.
a=[1,-0.8];
b=[0.8,-1];
[X,W]= freqz(b,a,512,'whole');
freqz(b,a,512,'whole');

4
i.
b=[0,0,0,0,0,0,0,0,0,0,1];
a=[1];
w0=pi/20;
n=-20:60;
x=sin(w0*n)+(sin(3*w0*n)/3)+(sin(5*w0*n)/5);
plot(x);
title('input graph');
figure;
F= filter(b,a,x);
n=-20:60;
stem(n,F);
hold on;
title('output graph');

ii.
a=[1];
b=[0.27,-0.46,0.27];
w0=pi/20;
n=-20:60;
x=sin(w0*n)+(sin(3*w0*n)/3)+(sin(5*w0*n)/5);
plot(x);
title('input graph');
figure;
F= filter(b,a,x);
n=-20:60;
stem(n,F);
hold on;
title('output graph');

iii.
a=[1,-0.8];
b=[0.8,-1];
w0=pi/20;
n=-20:60;
x=sin(w0*n)+(sin(3*w0*n)/3)+(sin(5*w0*n)/5);
plot(x);
title('input graph');

figure;
F= filter(b,a,x);
n=-20:60;
stem(n,F);
hold on;
title('output graph');

5.
i.
a=[1];
b=[0,0,0,0,0,0,0,0,0,0,1];
w0=pi/20;
n=-20:60;
x=sin(w0*n)+(sin(2*w0*n)/2)+(sin(3*w0*n)/3)+(sin(4*w0*n)/4)+(sin(5*w0*n)/5);
plot(x);
title('input graph');
figure;
F= filter(b,a,x);
n=-20:60;
stem(n,F);
hold on;
title('output graph');

ii.
a=[1];
b=[0.27,-0.46,0.27];
w0=pi/20;
n=-20:60;
x=sin(w0*n)+(sin(2*w0*n)/2)+(sin(3*w0*n)/3)+(sin(4*w0*n)/4)+(sin(5*w0*n)/5);
plot(x);
title('input graph');
figure;
F= filter(b,a,x);
n=-20:60;
stem(n,F);
hold on;
title('output graph');

iii.
a=[1,-0.8];
b=[0.8,-1];
w0=pi/20;
n=-20:60;
x=sin(w0*n)+(sin(2*w0*n)/2)+(sin(3*w0*n)/3)+(sin(4*w0*n)/4)+(sin(5*w0*n)/5);
plot(x);

title('input graph');
figure;
F= filter(b,a,x);
n=-20:60;
stem(n,F);
hold on;
title('output graph');

6.
i.
b=[0,0,0,0,0,0,0,0,0,0,1];
a=[1];
w0=pi/8;
n=-20:60;
x=sin(w0*n)+(sin(3*w0*n)/3)+(sin(5*w0*n)/5);
plot(x);
title('input graph');
figure;
F= filter(b,a,x);
n=-20:60;
stem(n,F);
hold on;
title('output graph');

ii.
a=[1];
b=[0.27,-0.46,0.27];
w0=pi/8;
n=-20:60;
x=sin(w0*n)+(sin(3*w0*n)/3)+(sin(5*w0*n)/5);
plot(x);
title('input graph');
figure;
F= filter(b,a,x);
n=-20:60;
stem(n,F);
hold on;
title('output graph');

iii.
a=[1,-0.8];
b=[0.8,-1];
w0=pi/8;
n=-20:60;
x=sin(w0*n)+(sin(3*w0*n)/3)+(sin(5*w0*n)/5);
plot(x);
title('input graph');

figure;
F= filter(b,a,x);
n=-20:60;
stem(n,F);
hold on;
title('output graph');