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

MATLAB FUNCTIONS

clc: Clear the command window.


xlabel: Label for X-axis.
ylabel: Label for Y-axis.
title: Title to the graph.
gird: To display grid lines in graph.
abs (x): This command computes the absolute value of the element of x,when x is complex
abs(x) is the magnitude of the element of x
angle (x):This command compute the phase angle in radians of vector x.
log10(x): This command computes the logarithm to the base 10 if the element x.
rem(n,N): This command determines the remainder after dividing n by N.
log (x): This command determines the remainder natural logarithm of each element in x.
mod (m,N): This command computes m mod N.
ones (N): Its an N-by-N matrix of ones.
ones (m,n): Its an m-by-n matrix of ones.
zeros (n): Its an n-by-n matrix of zeros .
plot (x,y): Plot vector y versus vector x.
subplot (a,b,c): It breaks the figure window in a-by-b matrix if small axis selects the Cth axis
for the current point.
[h,w] =freqz (b,a,N): It returns the N-point freq response vector h and n-point freq vector w
in redians/sample of fir filter described by (b,a) where a and b are numerator and denominator
co-efficient vector.
h = freqz (b,a,w): It returns the freq response at frequencies designated in vector w in
radians/samples.
h = filter (b,a,x): It filters the data in vector x with the filter data y by the vector a and b to
create the filtered data y.
y = conv (x,h): It computes the convolution of two sequence x and h.

h = impz (b,a,w): It computes N samples of the impulse response of the filter describe b and
a.
y = fft (x): It computes the FFT of the vector and stores it in vector y.
y = fft (x,N): It computes N-point FFT of the vector x by padding the sequence x with zeros if
the sequence length is less than the N-point truncated if it has more and stores it in vector y.
ifft (x): It computes the IFFT of the vector x.
ifft (x,N): It computes N-point IFFT of the vector x.
zplane (z,p): Plot the poles and zeros supplied by the column vector z and p.
zplane (num,den): plots the poles and zeros of the transfer function represented by the rows
in num and dem.
h = impz (num,den,n): It computes the impulse response of the digital filter transfer function
represented by num and dem.
[n,wn] = buttord (wp,ws,rp,rs): Find the lowest order N of digital butterworth filter that
loses no more than rp db in pass band and has atleast rs db of attenuation in stop band, wp
and ws are the passband and stopband edge frequencies normalized from 0 to 1.
[b,a] = butter (n,wn,high): Design an Nth order high pass digital butterworth filter.
[n,wn] = cheb1ord (wp,ws,rp,rs): Finds the lowest order n of the digital chebyshev type I
filter that loses no more than rp db in pass band and has atleast rs db of attenuation in stop
band wp and ws are the passband and stopband edge frequencies mormalised from 0 to 1.
[n,wn] = cheb2ord (wp,ws,rp,rs): Finds the lowest order n of the digital chebyshev type II
filter that loses no more than rp db in pass band and has atleast rs db of attenuation in stop
band wp and ws are the passband and stopband edge frequencies mormalised from 0 to 1.
[b,a] = cheby2 (n,r,wn): Design an nth order low pass digital chebyshev filter with the stop
band ripple r describe down and stop band edge frequency wn.
[b,a] = cheby2 (n,rs,wn,high): Design an Nth order high pass digital chebyshev filter
[b,a] = cheby2 (n,r,wn,stop): Design an nth order band stop digital chebyshev filter if
wn=[w1 w2].
[b,a] = cheby1 (n,r,Wn): Design an nth order low pass digital chebyshev type I filter with r
db of ripples in the stopband and r db of ripple ine pass band, cheby1 returns the filter co-
efficient n+1 vector with b (num) and a (den).
[b,a] = cheby1 (n,r,wn,high): Design an nth order high pass digital chebyshev type I filter.
[numd,dend] = bilinear(num,den,fs): Converts the s domain transfer function specified by
num and den containing numerator and denominator transfer function coefficient into z domain
transfer function are store in the vetor numd, dend.
W = boxcar (N): Return the N point rectangular window.
W = Bartlett (N): Return the N point bartlett triangular window.
W = hamming (N): Return N point, symmetric hamming window in coluwn vector.
hann (N): Return N point window symmetric hamming window in coluwn vector.
hanning (N): Return N point symmetric hamming window in coluwn vector. In this case the
first and cast zero-weighted window samples are not included.
blackman (N): Return N point symmetric blackman window in coluwn vector.
B = fir1 (N,Wn): Design a N order low pass FIR digital filter and return the filter, the filter
coefficient in length N+1 vector B. The cut-off freq Wn must be between 0 <Wn<10, with 1.0
corresponds to half the sample rate.
B = fir1(N,Wn,high): Design a N order FIR digital high pass filter
B = fir1 (N,Wn,stop): It is a bandstop filter if wn=[w,wn].
y = decimate (x,m): It resamples the sequence in the vector x at m times the original
sampling rate.
Expt 1. WAVEFORM GENERATION

CONTINUOUS TIME SIGNALS

% program for Unit Step Signal


clc;
t=0:1:10;
y=ones(1,11);
subplot(3,2,1);
plot(t,y,'k');
xlabel('Time');
ylabel('Amplitude');
title('Unit step Signal');

% program for Unit ramp Signal


clc;
t1=0:1:10; y1=t1;
subplot(3,2,2); plot(t1,y1,'k');
xlabel('Time'); ylabel('Amplitude'); title('Unit Ramp Signal');

% program for Sine wave


clc;
t2=0:0.1:10; y2=sin(t2);
subplot(3,2,3); plot(t2,y2,'k');
xlabel('Time'); ylabel('Amplitude'); title('Sine Wave');

% program for Cosine Wave


clc;
t3=0:0.1:10; y3=cos(t3);
subplot(3,2,4);plot(t3,y3,'k');
xlabel('Time'); ylabel('Amplitude'); title('Cosine Wave');

% program for Square wave


clc;
t4=0:0.001:10; y4=square(t4);
subplot(3,2,5); plot(t4,y4,'k');
xlabel('Time'); ylabel('Amplitude'); title('Square Wave');

% program for Sawtooth Wave


clc;
t5=0:0.1:10; y5=sawtooth(t5);
subplot(3,2,6); plot(t5,y5,'k');
xlabel('Time'); ylabel('Amplitude'); title('Sawtoth Wave');

Discrete Time signals


% program for unit Step sequenc
clc;
N=input('Enter the length of unit step sequence(N)= ');
n=0:1:N-1; y=ones(1,N);
figure;
subplot(3,2,1); stem(n,y,'k');
xlabel('Time'); ylabel('Amplitude'); title('Unit step Sequence');

% program for Ramp Sequence


N1=input('Enter the length of the unit ramp sequence(N)= ');
n1=0:1:N1-1; y1=n1;
subplot(3,2,2); stem(n1,y1,'k');
xlabel('Time'); ylabel('Amplitude'); title('Unit Ramp Sequence');

% program for Sine wave


N2=input('Enter the length of sinosoidal sequence(N)= ');
n2=0:0.1:N2-1; y2=sin(n2);
subplot(3,2,3); stem(n2,y2,'k');
xlabel('Time'); ylabel('Amplitude'); title('Sinosoidal Sequence');

% program for Cosine Wave


N3=input('Enter the length of cosine sequence(N)= ');
n3=0:0.1:N3-1; y3=cos(n3);
subplot(3,2,4); stem(n3,y3,'k');
xlabel('Time'); ylabel('Amplitude'); title('Cosine Sequence');

% program for exp sequence


N4=input('Enter the length of Exponential sequence(N)= ');
n4=0:1:N4-1;
a=input('Enter the value of Exponential sequence(a)= ');
y4=exp(a*n4);
subplot(3,2,5);stem(n4,y4,'k');
xlabel('Time'); ylabel('Amplitude'); title('Exponential Sequence');

% program for Unit Impulse


n5=-3:1:3; y5=[zeros(1,3),ones(1,1),zeros(1,3)];
subplot(3,2,6); stem(n5,y5,'k');
xlabel('Time'); ylabel('Amplitude'); title('Unit Impulse');
OUTPUT FOR GENERATION OF CONTINUOUS TIME SIGNAL:
Unit step Signal
Unit Ramp Signal
2
10
Amplitude

Amplitude
1
5

0 0
0 2 4 6 8 Time
10 0 2 4 6 8 10
Time
Sine Wave Cosine Wave
1 1
Amplitude

Amplitude
0 0

-1 -1
0 2 4 6 8 10 0 2 4 6 8 Time
10
Time
Square Wave Sawtooth Wave
1 1
Amplitude

Amplitude
0 0

-1 -1
0 2 4 6 8 10 0 2 4 6 8 10
Time Time

OUTPUT FOR GENERATION OF DISCRETE TIME SIGNAL:


Enter the length of unit step sequence(N)= 15
Enter the length of the unit ramp sequence(N)= 15
Enter the length of sinosoidal sequence(N)= 105
Enter the length of cosine sequence(N)= 15
Enter the length of Exponential sequence(N)= 15
Enter the value of Exponential sequence(a)= 0.2

Unit step Sequence Unit Ramp Sequence


1 15
Amplitude

Amplitude

10
0.5
5

0 0
0 5 10 15 0 5 10 15
Time Time
Sinosoidal Sequence Cosine Sequence
1 1
Amplitude

Amplitude

0 0

-1 -1
0 5 10 15 0 5 10 15
Time Time
Exponential Sequence Unit Impulse
20 1
Amplitude

Amplitude

10 0.5

0 0
0 5 10 15 -4 -2 0 2 4
Time Time
Expt 2 : LINEAR CONVOLUTION AND CIRCULAR CONVOLUTION

%Program for linear convolution


%input seqence
clc;clear all;close all;
x=input('Enter the input sequence(n)= ');
N1=length(x);
n=0:1:(N1-1);
subplot(3,1,1); stem(n,x,'k');
xlabel('n----->'); ylabel('Amplitude'); title('input sequence X(n)');

%impulse seq.
h=input('Enter the impulse sequence h(n)= ');
N2=length(h);
n1=0:1:N2-1;
subplot(3,1,2); stem(n1,h,'k');
xlabel('n--->'); ylabel('Amplitude'); title('impulse sequence h(n)');

%Output conv.
y=conv(x,h)
N=N1+N2-1;
n2=0:1:N-1;
subplot(3,1,3); stem(n2,y,'k');
xlabel('Time'); ylabel('Amplitude'); title('Linear Convolution of two sequence');

OUTPUT FOR LINEAR CONVOLUTION:


Enter the input sequence x(n)= [1 2 3 4]
Enter the impulse sequence h(n)= [1 2 3 1]
y= 1 4 10 17 19 15 4
input sequence X(n)
Amplitude 4

0
0 0.5 1 1.5 2 2.5 3
n----->
impulse sequence h(n)
4
Amplitude

0
0 0.5 1 1.5 2 n---> 2.5 3
Linear Convolution of two sequence
20
Amplitude

10

0
0 1 2 3 4 5 6
Time

CIRCULAR CONVOLUTION

%Program for circular convolution


clc; clear all; close all;
x=input('Enter the input sequence x1(n)= ');
N1=length(x);
h=input('Enter the impulse sequence x2(n)= ');
N2=length(h);
n=0:1:N1-1;
subplot(3,1,1); stem(n,x);
xlabel('n--->'); ylabel('Amplitude'); title('x1(n) Input sequenc 1);
n=0:1:N2-1;
subplot(3,1,2); stem(n,h);
xlabel('n--->'); ylabel('Amplitude'); title('x2(n) Input sequence 2');
N=max(N1,N2);
x=[x,zeros(1,N-N1)];
h=[h,zeros(1,N-N2)];
for n=1:N
y(n)=0;
for i=1:N
j=n-i+1;
if(j<=0)
j=N+j;
end
y(n)=y(n)+x(i)*h(j);
end
end
disp('Convolution of x1(n) & x2(n) is');
disp(y); subplot(3,1,3); stem(y);
xlabel('n--->'); ylabel('Amplitude'); title('Convolution of x1(n)&x2(n) Response');

OUTPUT FOR CIRCULAR CONVOLUTION:


Enter the impluse sequence x1(n)= [1 2 3 4]
Enter the impulse sequence x2(n)= [1 2 3 1]
Convolution of x1(n) & x2(n) is 20 19 14 17

x1(n) Input Sequence 1


4
Amplitude

0
0 0.5 1 1.5 2 n---> 2.5 3
x2(n) Input Sequence 2
4
Amplitude

0
0 0.5 1 1.5 2 n---> 2.5 3
Convolution of x1(n)&x2(n) Response
20
Amplitude

10

0
1 1.5 2 2.5 3 3.5 4
n--->

Expt 3: SAMPLING AND EFFECT OF ALIASING

clc;close all; clear all;


% Time period of 15 Hz signal with 0.1s duration at 1000Hz
t=0:0.001:0.1;
fm = 15; x=sin(2*pi*fm*t);
figure(1) ; plot(t,x);
xlabel('Time'); ylabel('Amplitude'); title('Original Analog signal');

%Analog sig sampled at fs<<2fm


fs=2*fm/3;
n=0:1/fs:0.1; xn=sin(2*pi*fm*n);
figure(2) subplot(2,1,1); stem(n,xn);
xlabel('Time'); ylabel('Amplitude');
title('Undersampled fs<<2fm signal');
subplot(2,1,2); plot(n,xn);
xlabel('Time'); ylabel('Amplitude');
title('Reconstructed undersampled fs<<2fm signal');

%Analog signal sampled at % fs=2fm


fs=2*fm;
n=0:1/fs:0.1; xn=sin(2*pi*fm*n);
figure(3) subplot(2,1,1); stem(n,xn);
xlabel('Time'); ylabel('Amplitude');
title('Sampled at Nyquist rate fs=2fm signal');
subplot(2,1,2); plot(n,xn);
xlabel('Time'); ylabel('Amplitude');
title('Reconstructed Nyquist rate fs=2fm signal');

%Analog sig sampled at fs>>2fm


fs=40*fm;
n=0:1/fs:0.1; xn=sin(2*pi*fm*n);
figure(4) subplot(2,1,1); stem(n,xn);
xlabel('Time'); ylabel('Amplitude');
title('Oversampled fs>>2fm signal');
subplot(2,1,2); plot(n,xn);
xlabel('Time'); ylabel('Amplitude');
title('Reconstructed oversampled fs>>2fm signal');

-16 Undersampled fs<<2fm signal


Original A nalog signal x 10
1 4
0.8

0.6 3
Amplitude

0.4

0.2 2
Amplitude

-0.2 1
-0.4

-0.6 0
-0.8 0 0.02 0.04 0.06 0.08 0.1
Time
-1
0 0.02 0.04 0.06 0.08 0.1 -16
Time
x 10 Reconstructed undersampled fs<<2fm signal
4

3
Amplitude

0
0 0.02 0.04 0.06 0.08 0.1
Time
-16 Sampled at Nyquist rate fs=2fm signal Oversampled fs>>2fm signal
x 10 1
8

6 0.5

Amplitude
Amplitude

4 0

2 -0.5

-1
0 0 0.02 0.04 0.06 Time 0.08 0.1
0 0.02 0.04 0.06 Time 0.08 0.1
Reconstructed oversampled fs>>2fm signal
-16 Reconstructed Nyquist rate fs=2fm signal
x 10 1
8
0.5
6

Amplitude
0
Amplitude

4
-0.5
2
-1
0 0 0.02 0.04 0.06 0.08 0.1
0 0.02 0.04 0.06 0.08 0.1 Time
Time

Expt 4. CALCULATION OF FFT AND IFFT


clc; clear all; close all;
N=input('Enter the fft points (N)= ');
x=input('Enter the input sequence(x)= ');
xlen=length(x)
n=0:1:(xlen-1);
subplot(2,2,1); stem(n,x,'k');
xlabel('N--->'); ylabel('Amplitude');
title('Input sequence');
k=0:1:(N-1);
X=fft(x,N);
subplot(2,2,2); stem(k,abs(X),'k');
xlabel('k--->'); ylabel('Amplitude');
title('Magnitude Plot(FFT)');
subplot(2,2,3); stem(k,angle(X),'k');
xlabel('k--->'); ylabel('Angle'); title('Phase Plot(FFT)');
n=0:1:(N-1);
x=ifft(X,N);
subplot(2,2,4); stem(n,abs(x),'k');
xlabel('n--->'); ylabel('Amplitude'); title('Magnitude Plot');
Output for FFT:Enter the fft points N= 8 ;
Enter the input sequence(x)= [1 2 3 4 5 6 7 8]
Fft of X =[ 36.0000 , -4.0000 + 9.6569i , -4.0000 + 4.0000i , -4.0000 + 1.6569i , -4.0000 , -
4.0000 - 1.6569i , -4.0000- 4.0000i , -4.0000 - 9.6569i]

Input sequence Magnitude Plot(FFT)


8 40

6 30
Amplitude

Amplitude
4 20

2 10

0 0
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
N---> k--->

Phase Plot(FFT) Magnitude Plot


4 8

2 6

Amplitude
Angle

0 4

-2 2

-4 0
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
k---> n--->

%program for DFT & IDFT


clc;
x1=input('Enter the input sequence ');
N=length(x1);
n=0:1:N-1; k=0:1:N-1;
WN=exp(-1i*2*pi/N);
nk=n'*k; WnNK=WN.^nk;
Xk=x1*WnNK;
Xkmag=abs(Xk);
WNnk=WN.^(-nk);
xn=Xk*WNnk/N;
subplot(3,1,1); stem(n,x1);
xlabel('time period'); ylabel('Amplitude');
title('input sequence');
subplot(3,1,2); stem(n,Xkmag);
xlabel('time period'); ylabel('Amplitude'); title('DFT');
subplot(3,1,3); stem(n,xn);
xlabel('time period'); ylabel('Amplitude'); title('IDFT');
Output for DFT: Enter the input sequence(x)= [1 2 3 4 5 6 7 8]

DFT of X =[ 36.0000 , -4.0000 + 9.6569i , -4.0000 + 4.0000i , -4.0000 + 1.6569i , -4.0000 , -


4.0000 - 1.6569i , -4.0000- 4.0000i , -4.0000 - 9.6569i]
input sequence
10

Amplitude
5

0
0 1 2 3 4 5 6 7
n----->
DFT
40
Amplitude

20

0
0 1 2 3 4 5 6 7
k------->
IDFT
10
Amplitude

0
0 1 2 3 4 k------> 5 6 7

Expt 5. IIR DIGITAL FILTER S

%Program for Butterworth filter


clear all; clc; close all;
format long
rp=input('Enter the ripple of pass band (rp)= ');
rs=input('Enter the ripple of stop band (rs)= ');
fp=input('Enter the frequency of pass band (fp)= ');
fs=input('Enter the frequency of stop band (fs)= ');
fsamp=input('Enter the sampling frequency (F)= ');
w1=2*fp/fsamp; w2=2*fs/fsamp;
%LOW PASS FILTER
[n,wn]=buttord(w1,w2,rp,rs);
[b,a]=butter(n,wn);
w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h)); an=angle(h);
disp('Filter order'); disp(n);
disp('Cut-off frequency'); disp(wn);
figure(1); Subplot(2,1,1); plot(om/pi,m);
ylabel('Gain in deciBel'); xlabel('Normalized frequency in rad/sec');
title('Magnitude Plot (LPF)');
figure(1); Subplot(2,1,2); plot(om/pi,an);
xlabel('Normalized frequency in rad/sec'); ylabel('Phase Angle in rad');
title('Phase Plot (LPF)');
%BAND STOP FILTER
fp1=input('Enter the frequency of pass band :fp1= ');
fp2=input('Enter the frequency of pass band :fp2= ');
fs1=input('Enter the frequency of stop band :fs1= ');
fs2=input('Enter the frequency of stop band :fs2= ');
[n,Wn] = buttord([fp1 fp2]/fsamp,[fs1 fs2]/fsamp,rp,rs)
[b,a]=butter(n,wn,'stop');
w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h)); an=angle(h);
figure(4); subplot(2,1,1); plot(om/pi,m);
ylabel('Gain in deciBel'); xlabel('Normalized frequency in rad/sec');
title('Magnitude Plot (BSF)');
figure(4); subplot(2,1,2); plot(om/pi,an);
xlabel('Normalized frequency in rad/sec');
ylabel('Phase Angle in rad'); title('Phase Plot (BSF)');
OUTPUT FOR BUTTERWORTH IIR DIGITAL FILTER :
Enter the ripple of pass band (rp)= 3
Enter the ripple of stop band (rs)= 60
Enter the frequency of pass band (fp)= 1200
Enter the frequency of stop band (fs)= 2400
Enter the sampling frequency (F)= 10000
Filter order = 9
Cut-off frequency= 0.261679403087383
Magnitude Plot (HPF)
100

0
Gain in deciBel

-100

-200

-300
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized frequency in rad/sec

Phase Plot (HPF)


4
Phase Angle in rad

-2

-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized frequency in rad/sec
Magnitude Plot (BSF)
50

Gain in deciBel
-50

-100

-150

-200
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized frequency in rad/sec

Phase Plot (BSF)


4
Phase Angle in rad

-2

-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized frequency in rad/sec

% Chebyshev filters
clear all; clc; close all;
rp=input('Enter the pass band ripple:');
rs=input('Enter the stop band ripple:');
fp=input('Enter the pass band frequency:');
fs=input('Enter the stop band frequency:');
fsamp=input('Enter the sampling frequency:');
wp=2*fp/fsamp; ws=2*ws/fsamp;
%LOW PASS FILTER
[n,wn]=cheb1ord(wp,ws,rp,rs);
[b,a]=cheby1(n,rp,wn);
w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h)); an=angle(h);
disp('Filter order'); disp(n); disp('Cut-off frequency'); disp(wn);
subplot(2,1,1); plot(om/pi,m);
ylabel('Gain in db--->'); xlabel('(a)Normalized frequency--->');
title('Low pass filter');
subplot(2,1,2); plot(om/pi,an);
xlabel('(b)Normalized frequency--->'); ylabel('Phase in radians--->');

%BAND STOP FILTER


rp=input(enter passband ripple rp=);
rs=input(enter passband ripple rs=);
fp1=input('Enter the frequency of pass band :fp1= ');
fp2=input('Enter the frequency of pass band :fp2= ');
fs1=input('Enter the frequency of stop band :fs1= ');
fs2=input('Enter the frequency of stop band :fs2= ');
[n,Wn] = cheb1ord([fp1 fp2]/fsamp,[fs1 fs2]/fsamp,rp,rs)
[b,a]=cheby1(n,rp,wn,'stop');
w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h)); an=angle(h);
figure(4); subplot(2,1,1); plot(om/pi,m);
ylabel('Gain in db--->'); xlabel('(a)Normalized frequency--->');
title('Bandstop filter');
figure(4); subplot(2,1,2); plot(om/pi,an);
xlabel('(b)Normalized frequency--->'); ylabel('Phase in radians--->');
Chebyshev type-II
Example 1: (Lowpass)
Wp = 40/500; Ws = 150/500;
Rp = 3; Rs = 60;
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs)
[b,a] = cheby2(n,Rs,Ws);
Example 2:(Bandpass)
Wp = [60 200]/500; Ws = [50 250]/500;
Rp = 3; Rs = 40;
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs)
[b,a] = cheby2(n,Rs,Ws);
OUTPUT FOR CHEBYSHEV Type-1 IIR DIGITAL FILTER:
Enter the pass band ripple:0.02
Enter the stop band ripple:.03
Enter the pass band frequency:1200
Enter the stop band frequency:2400
Enter the sampling frequency:8000
Filter order :1 , Cut-off frequency : 0.300000000000000

Low pass filter


0

-10
Gain in db--->

-20

-30

-40

-50
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
(a)Normalized frequency--->

0
Phase in radians--->

-0.5

-1

-1.5

-2
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
(b)Normalized frequency--->
Bandstop filter
0

-5

Gain in db--->
-10

-15

-20
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
(a)Normalized frequency--->

1.5

1
Phase in radians--->

0.5

-0.5

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
(b)Normalized frequency--->