Вы находитесь на странице: 1из 7

ECX-316 Digital Signal Processing Laboratory 2018

EXPERIMENT NO. 10(B)


AIM :Write a program to study Chebyshev(Type-2) filter by implementing it as
1. Low pass filter
2. High pass filter
3. Band pass filter
4. Band stop filter

SOFTWARE REQUIRED: MATLAB VERSION: 8.1.0.604 (R2015a)

THEORY:

Chebyshev Type II filters are closely related to Chebyshev Type I filters, and are noted for having a
flat passband magnitude response, and an equiripple response in the stopband. Type I response is
often simply referred to as the Chebyshev response. Similarly, the Chebyshev Type II response is
often referred to as the Inverse Chebyshev response.
Also known as inverse Chebyshev filters, the Type II Chebyshev filter type is less common because
it does not roll off as fast as Type I, and requires more components. It has no ripple in the passband,
but does have equiripple in the stopband. The gain is:

In the stopband, the Chebyshev polynomial oscillates between -1 and 1 so that the gain will
oscillate between zero and

and the smallest frequency at which this maximum is attained is the cutoff frequency
The parameter ε is thus related to the stopband attenuation γ in decibels by:

DESIGN SETUP:

clc
close all
rp=3;
rs=10;
wp=120;
fs=1000;
ws=170;
w1= 2*wp/fs;

38 Department of Elect. and Comm. Engg. , Dr. B R Ambedkar National Institute of Technology, Jalandhar
ECX-316 Digital Signal Processing Laboratory 2018

w2= 2*ws/fs;
[n,wn]=cheb1ord(w1,w2,rp,rs);
n;
wn;
[b,a]=cheby2(n,rp,w1);

w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an= angle(h);

subplot(4,2,1)
plot(om/pi,m);
title(sprintf('n= %d CHEBYSHEV(II) low pass FILTER magnitude response',n));
ylabel('Gain in db');
xlabel('Normalized Frequency');

subplot(4,2,2)
plot(om/pi,an);
title('IIR CHEBYSHEV(II) low pass FILTER phase response')
xlabel('Normalized Frequency');
ylabel('Phase in radians')
%************************************************************************

wp=350;
ws=240;
w1= 2*wp/fs;
w2= 2*ws/fs;
[n,wn]=cheb1ord(w1,w2,rp,rs);
n;
wn;
[b,a]=cheby2(n,rp,w1,'High');

w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an= angle(h);

subplot(4,2,3)
plot(om/pi,m);
title(sprintf('n=%d CHEBYSHEV(II) high pass FILTER magnitude response',n));
ylabel('Gain in db');
xlabel('Normalized Frequency');

subplot(4,2,4)
plot(om/pi,an);
title('IIR CHEBYSHEV(II) high pass FILTER phase response')
xlabel('Normalized Frequency');
ylabel('Phase in radians')

%****************************************************************
wp=[120 270];
ws=[100 340];
w1= 2*wp/fs;
w2= 2*ws/fs;

[n,wn]=cheb1ord(w1,w2,rp,rs);
n
wn
[b,a]=cheby2(n,rp,w1,'bandpass');

39 Department of Elect. and Comm. Engg. , Dr. B R Ambedkar National Institute of Technology, Jalandhar
ECX-316 Digital Signal Processing Laboratory 2018

w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an= angle(h);

subplot(4,2,5)
plot(om/pi,m);
title(sprintf('n=%d CHEBYSHEV(II) Band pass FILTER magnitude response',n));
ylabel('Gain in db');
xlabel('Normalized Frequency');

subplot(4,2,6)
plot(om/pi,an);
title(sprintf('n=%d CHEBYSHEV(II) Band pass FILTER phase response',n));
xlabel('Normalized Frequency');
ylabel('Phase in radians')

%*************************************************
wp=[140 340];
ws=[150 290];
w1= 2*wp/fs;
w2= 2*ws/fs;
[n,wn]=cheb1ord(w1,w2,rp,rs);
n;
wn;
[b,a]=cheby2(n,rp,w1,'stop');

w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an= angle(h);

subplot(4,2,7)
plot(om/pi,m);
title(sprintf('n=%d CHEBYSHEV(II) Band stop FILTER magnitude response',n));
ylabel('Gain in db');
xlabel('Normalized Frequency');

subplot(4,2,8)
plot(om/pi,an);
title('IIR CHEBYSHEV(II) Band stop FILTER phase response')
xlabel('Normalized Frequency');
ylabel('Phase in radians')

40 Department of Elect. and Comm. Engg. , Dr. B R Ambedkar National Institute of Technology, Jalandhar
ECX-316 Digital Signal Processing Laboratory 2018

RESULT:

n= 2 CHEBYSHEV(II) low pass FILTER magnitude response IIR CHEBYSHEV(II) low pass FILTER phase response
0 2

-50 0

-100 -2
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Normalized Frequency Normalized Frequency
n=2 CHEBYSHEV(II) high pass FILTER magnitude response IIR CHEBYSHEV(II) high pass FILTER phase response
0 2

-20
0
-40
-2
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Normalized Frequency Normalized Frequency
n=2 CHEBYSHEV(II) Band pass FILTER magnitude response n=2 CHEBYSHEV(II) Band pass FILTER phase response
0 2

-20
0
-40
-2
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Normalized Frequency Normalized Frequency
n=3 CHEBYSHEV(II) Band stop FILTER magnitude response IIR CHEBYSHEV(II) Band stop FILTER phase response
50 5

0 0

-50 -5
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Normalized Frequency Normalized Frequency

CONCLUSION:
Chebyshev filter(Type-II) has been studied and waveforms of various filters, viz. low-pass filter,
high-pass filter, band-pass filter, band-stop filter have been plotted along with their phase responses.

41 Department of Elect. and Comm. Engg. , Dr. B R Ambedkar National Institute of Technology, Jalandhar
ECX-316 Digital Signal Processing Laboratory 2018

EXPERIMENT NO. 11(A)


AIM :Write a program to study FIR(Type-1) filter by implementing it as
1. Low pass filter
2. High pass filter
3. Band pass filter
4. Band stop filter

SOFTWARE REQUIRED: MATLAB VERSION: 8.1.0.604 (R2015a)

THEORY:

In signal processing, a finite impulse response (FIR) filter is a filter whose impulse response (or
response to any finite length input) is of finite duration, because it settles to zero in finite time. This
is in contrast to infinite impulse response (IIR) filters, which may have internal feedback and may
continue to respond indefinitely (usually decaying).
The impulse response (that is, the output in response to a Kronecker delta input) of an Nth-order
discrete-time FIR filter lasts exactly N + 1 samples (from first nonzero element through last nonzero
element) before it then settles to zero.
FIR filters can be discrete-time or continuous-time, and digital or analog.
For a causal discrete-time FIR filter of order N, each value of the output sequence is a weighted sum of
the most recent input values:

where:

 x[n] is the input signal,


 y[n] is the output signal,
 N is the filter order; an Nth-order filter has (N+1) terms on the right-hand side
 Bi is the value of the impulse response at the i'th instant for 0<i<n of an Nth-order FIR
filter. If the filter is a direct form FIR filter then bi is also a coefficient of the filter.

42 Department of Elect. and Comm. Engg. , Dr. B R Ambedkar National Institute of Technology, Jalandhar
ECX-316 Digital Signal Processing Laboratory 2018

DESIGN SETUP:

clc;
clear all;
b = fir1(48,[0.35 0.65]);
w=0:0.01:pi;
[h,om]=freqz(b,1,w);
m=20*log10(abs(h));
an= angle(h);
subplot(4,2,1)
plot(om/pi,m);
title(sprintf('FIR(I) Bandpass FILTER magnitude response'));
ylabel('Gain in db');
xlabel('Normalized Frequency');
subplot(4,2,2)
plot(om/pi,an);
title('FIR(I) Bandpass FILTER phase response')
xlabel('Normalized Frequency');
ylabel('Phase in radians')
%*******************************************

load chirp
t = (0:length(y)-1)/Fs;
bhi = fir1(34,0.48,'high',chebwin(35,30));
[h,om]=freqz(bhi,1,w);
m=20*log10(abs(h));
an= angle(h);
subplot(4,2,3)
plot(om/pi,m);
title(sprintf('FIR(I) HighPass FILTER magnitude response'));
ylabel('Gain in db');
xlabel('Normalized Frequency');
subplot(4,2,4)
plot(om/pi,an);
title('FIR(I) HighPass FILTER phase response')
xlabel('Normalized Frequency');
ylabel('Phase in radians')

%***************************************************
load chirp
t = (0:length(y)-1)/Fs;
bhi = fir1(34,0.48,'low',chebwin(35,30));
[h,om]=freqz(bhi,1,w);
m=20*log10(abs(h));
an= angle(h);
subplot(4,2,5)
plot(om/pi,m);
title(sprintf('FIR(I) LowPass FILTER magnitude response'));
ylabel('Gain in db');
xlabel('Normalized Frequency');
subplot(4,2,6)
plot(om/pi,an);
title('FIR(I) LowPass FILTER phase response')
xlabel('Normalized Frequency');
ylabel('Phase in radians')
%******************************************************
b = fir1(48,[0.35 0.65],'stop');
w=0:0.01:pi;
[h,om]=freqz(b,1,w);
m=20*log10(abs(h));
an= angle(h);
subplot(4,2,7)

43 Department of Elect. and Comm. Engg. , Dr. B R Ambedkar National Institute of Technology, Jalandhar
ECX-316 Digital Signal Processing Laboratory 2018

plot(om/pi,m);
title(sprintf('FIR(I) Bandstop FILTER magnitude response'));
ylabel('Gain in db');
xlabel('Normalized Frequency');
subplot(4,2,8)
plot(om/pi,an);
title('FIR(I) Bandpass FILTER phase response')
xlabel('Normalized Frequency');
ylabel('Phase in radians')

RESULT:

Phase in radians
Gain in db

Phase in radians
Gain in db

Phase in radians
Gain in db

Phase in radians
Gain in db

CONCLUSION:
FIR filter(Type-I) has been studied and waveforms of various filters, viz. low-pass filter, high-pass
Filter, band-pass filter, band-stop filter have been plotted along with their phase responses.

44 Department of Elect. and Comm. Engg. , Dr. B R Ambedkar National Institute of Technology, Jalandhar

Вам также может понравиться