0% found this document useful (0 votes)
47 views15 pages

Assignment 1

The document contains code that defines different filters using various b and a coefficients. It generates input signals, applies the filters, and plots the input and output graphs to observe the effect of the filters. The code is organized into sections that apply the same filters to different input signals and vary the frequency of those signals.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views15 pages

Assignment 1

The document contains code that defines different filters using various b and a coefficients. It generates input signals, applies the filters, and plots the input and output graphs to observe the effect of the filters. The code is organized into sections that apply the same filters to different input signals and vary the frequency of those signals.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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');

You might also like