Você está na página 1de 51

DEPARTMENT OF

ELECTRONICS AND COMMUNICATION ENGINEERING

III YEAR B.E EEE

11PBEC52 DIGITAL SIGNAL PROCESSING LAB

2016 2017

NAME : _________________________________________

REGISTER NO: _________________________________________


DEPARTMENT OF
ELECTRONICS AND COMMUNICATION ENGINEERING

BONAFIDE CERTIFICATE

This is to certify that this is a Bonafide Record of Practical Work done by

Mr./Ms .. Register No.of B.E


ELECTRONICS AND COMMUNICATION ENGINEERING in the DIGITAL SIGNAL
PROCESSING LABORATORY() during the academic year 2016-2017.

HEAD OF THE DEPARTMENT STAFF-IN-CHARGE

Submitted for the Practical Examination held on ..

INTERNAL EXAMINER EXTERNAL EXAMINER


INDEX
S.N DATE EXPERIMENT TOPICS Pg. MAR SIGN
O No KS
1 INTRODUCTION TO MATLAB

2 GENERATION OF CONTINUOUS TIME (SINE


& COSINE ) SIGNALS

3 GENERATION OF CONTINUOUS TIME (UNIT


STEP, RAMP AND EXPONENTIAL ) SIGNALS

4 GENERATION OF DISCRETE TIME (SINE &


COSINE) SIGNALS

5 GENERATION OF DISCRETE TIME (UNIT


STEP, RAMP AND EXPONENTIAL) SIGNALS

6 VERIFICATION OF SAMPLING THEOREM

7 LINEAR CONVOLUTION

8 CIRCULAR CONVOLUTION

9 OVERLAP SAVE METHOD OF TWO SIGNALS

10 SPECTRAL ANALYSIS OF DISCRETE TIME


SIGNALS

11 CALCULATION OF FFT

12 DETERMINATION OF FREQUENCY
RESPONSE OF AN LTI SYSTEM

13 DESIGN OF IIR BUTTERWORTH FILTER


USING LOW PASS FILTER

14 DESIGN OF IIR BUTTERWORTH FILTER


USING IMPULSE INVARIANT TECHNIQUE
15 DESIGN OF IIR BUTTERWORTH FILTER
USING BILINEAR TRANSFORMATION

16 DESIGN OF IIR CHEBYSHEV FILTER USING


IMPULSE INVARIANT TECHNIQUE

17 DESIGN OF IIR CHEBYSHEV FILTER USING


BILINEAR TRANSFORMATION TECHNIQUE

18 DESIGN OF FIR FILTER USING WINDOWS


EXP NO : 1
INTRODUCTION TO MATLAB
DATE :

AIM :
To study in detail about MATLAB software.

DESCRIPTION :
MATLAB is a special purpose program optimized to perform engineering and
scientific calculation.

WHAT IS MATLAB ?
Matrix laboratory.
Matrix is the basic data element.
Matrix calculator.

WHY MATLAB ?
Essential tool for engineers and scientists.
Interactive mathematical calculation.
Simple programmability.
Consistent functional environment.
Easy to use integrated graphics.
Availability on a wide variety of hardware.
Numerous tool boxes covering a wide range of subjects.
To name a few signal processing, control systems, communication, fuzzy
systems, image processing, statistics, financial etc.
Dynamic System Simulation through SIMULINK 3.

MATLAB FUNCTIONS :
IN-BUILT FUNCTIONS
Built into the interpreter.
M-FILE FUNCTIONS
ASCII files containing the algorithms.
Algorithms on specific topics as TOOL BOXES.
USER functions (user can program using m-files).

ACCESSING MATLAB :
Click on the Matlab icon. Command window will be opened. Commands can be
typed at the command prompt >>

MATLAB help ,
Use help command for Matlab help
>> help command name
>>lookforkeyword

MATLA WINDOWS :
1) Command window
2) Editor
3) Graphic window

ENTERING MATRICES :
M = [1 2 3; 4 5 6] OR
M = [1,2,3; 4,5,6]

MATRIX OPERATIONS AND ARRAY OPERATIONS :

Addition +
Subtraction -
Multiplication *
Power ^
Conjugate transpose
Division /

DOT OPERATIONS :

Eg: A = [1 2 3];
B = [2 4 6];
C = A .* B = [1*2, 2*4, 3*6] ;
C = A ./ B = [1/2, 2/4, 3/6] ;
C = A .^ B = [12, 24, 36] ;

WORKSPACE VARIABLES :

WHO Lists all variables

WHOS Lists all variables with detail

RANGE OF NUMBERS 10-308 TO 10 308 COMPLEX VARIABES :

a = 2 + 5i complex number
A = [1 + 5i, 2 + 6i; 3 + 7i, 4 + 8i]
A = [1 2; 3 4] + i[5 6; 7 8]
ELEMENTARY MATH FUNCTIONS :

Trigonometric Functions :
Sin asin sinh asinh
Exponential Functions :
Exp log log10 sqrt

Complex Functions :
Abs angle conj imag real

COLON OPERATOR :
1:3 =[123]
1 : 0.5 : 3 = [ 1,1.5,2,2.5,3 ]

RELATIONAL / LOGICAL :
< , <= , > , >= , == and ~=.
& logical AND.
I logical OR.
~ logical complement (NOT)
XOR exclusive OR.

SPECIAL CHARACTERS :
( ) Parantheses are used to indicate precedence in arithmetic expressions
and to enclose
arguments of functions in the usual way.
[ ] Brackets
Continuation
, Element separator
; Row
% Comments
Transpose, quote
= Assignment

FLOW CONTROL :
FOR loop
WHILE loop
IF statement
POLYNOMIALS :
MATLAB represents polynomials as row vectors containing co-efficients ordered
by descending powers.
For example, consider the polynomial,
a(s) = + 2s + 3 and

b(s) = + 5s + 6
MATLAB representation of a(s) and b(s) are,
a = [123]
b = [456]

ROOTS OF POLYNOMIAL :
p = - - 72s 27
p = [ 1 , -6 , -72 , -27 ]
r = ROOTS(p) = [ 12 , 1229 ; -5.7345 ; -0.3884 ]
The polynomial can be got from
The roots as p = poly
Use help polyfun to see polynomial functions.

PLOTTING :
Plot
Stem
Subplot

Plot :
x = -4 : 0.01 : 4 ; y = sin(x) ; plot(x,y) ;
x = -1.5 : 0.01 : 1.5 : y = exp(-x.^2) ; plot(x,y)
x = -4 : 0.01 : 4 ; y = sin(x) ; plot(x.y,r*) ;

SIN plotted in red colour using * symbol

Tiltle graph title


xlabel x axis label
ylabel y axis label
gtext place text on the graph using the mouse
text position text at specified co-ordinates.

Stem :
x = [ 0 : 0.1 : 2 * pi ] ; y = sin(x) ; stem(x,y)
Subplot :

Subplot(m,n,p) or subplot(mnp) , breaks the figure window into an m-by-n


matrix of small axes , selects the p-th axes for the current plot. The axes are
counted along the top row of the figure window , then the second row , etc..

x = -4 : 0.01 : 4 ;
y = sin(x);
subplot( 2,1,1 );
plot(x,y);
x = -1.5 : 0.01 : 1.5 ;
y = exp(-x.^2);
subplot( 2,1,2 );
plot(x,y);

RESULT :

Thus the introduction of MATLAB software was studied in detail.


EXP.NO : 2
GENERATION OF CONTINUOUS TIME
DATE : SIGNALS
(SINE AND COSINE WAVE)
AIM :
To generate a Continuous time signals (sine and cosine wave) using MATLAB
software.

SOFTWARE REQUIRED :
MATLAB 7.1

ALGORITHM :

Start the program.


Get the input t value from the user.
Assign the range of time axis.
Give the title for the X-axis and Y-axis of the program.
To plot the square using a continuous value.
End the program.

PROGRAM:

clc;
close all;
clear all;
t=0:0.01:1;
f=2;
%sine signal
s=sin(2*pi*f*t);
subplot(2,1,1);
plot(t,s);
title('Sine signal');
xlabel('t-time');
ylabel('x(t)-amplitude');
grid;
%cosine signal
c=cos(2*pi*f*t);
subplot(2,1,2);
plot(t,c);
title('Cosine signal');
xlabel('t-time');
ylabel('x(t)-amplitude');
grid;
OUTPUT :

Sine signal
1
x(t)-amplitude

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
t-time
Cosine signal
1
x(t)-amplitude

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
t-time

RESULT :
Thus the continuous time signals (sine and cosine wave) were generated using
MATLAB software.
EXP NO : 3
GENERATION OF CONTINUOUS TIME
SIGNALS
DATE :

(STEP, RAMP AND EXPONENTIAL


SIGNAL)

AIM :
To generate continuous time signals ( step, ramp and exponential signals ) using
MATLAB software.

SOFTWARE REQUIRED :
MATLAB 7.1

ALGORITHM :

Start the program.


Get the input value t from the user.
Assign the range of time axis.
Give the title for the X=axis and Y-axis of the program.
Then plot the square using a continuous value.
End the program.

PROGRAM :

clc;
clear all;
close all;
%step signal
y1=ones(1,20);
title('step');
subplot(2,2,1);
plot (y1);
grid;
%ramp signal
t=0:0.01:1;
y2=t;
title('ramp');
subplot(2,2,2);
plot(t,y2);
grid;
%exponential
t=0:0.01:1;
y3=exp(t);
title('exponential');
subplot(2,2,3);
plot(t,y3);
grid;
OUTPUT :
ramp exponential
2 1

0.8
1.5
0.6
1
0.4
0.5
0.2

0 0
0 5 10 15 20 0 0.5 1

2.5

1.5

1
0 0.5 1

RESULT :
Thus the continuous time signals (step, ramp and exponential signals) were
generated using MATLAB software.
EXP NO : 4
GENERATION OF DISCRETE TIME
SIGNALS
DATE :
( SINE AND COSINE WAVE )

AIM :
To generate a discrete time signal ( sine and cosine wave ) using MATLAB
software.

APPARATUS REQUIRED :
MATLAB 7.1

ALGORITHM :

Start the program.


Get the input n value from the user.
Assign the range of time axis.
Give the title for the X-axis and Y-axis of the program.
Then plot the square using a discrete value.
End the program.

PROGRAM :

clc;
close all
clear all;
n=0:0.01:1;
f=2;
%sine signal
s=sin(2*pi*f*n);
subplot(2,1,1);
stem(n,s);
title('sine wave');
xlabel('n-time')
ylabel('x(n)-amplitude');
grid;
%cosine signal
c=cos(2*pi*f*n);
subplot(2,1,2)
stem(n,c);
title('cosine wave');
xlabel('n-time');
ylabel('x(n)-amplitude');
grid;
OUTPUT :
sine wave
1
x (n)-am plitude

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
n-time
cosine wave
1
x (n)-am plitude

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
n-time

RESULT :
Thus the discrete time signals ( sine and cosine wave ) were generated using
MATLAB software.

EXP NO : 5
GENERATION OF DISCRETE TIME
DATE : SIGNALS
(STEP, RAMP AND EXPONENTIAL
SIGNALS)

AIM :
To generate a discrete time signals (step,ramp and exponential signals) using
MATLAB software.

SOFTWARE REQUIRED :
MATLAB 7.1

ALGORITHM :

Start the program.


Get the input n value from the user.
Assign the range of time axis.
Give the title for the X-axis and Y-axis of the program.
Then plot the square using a discrete value.
End the program.

PROGRAM :
clc;
clear all;
close all;
%step signal
y1=ones(1,20);
title('step');
subplot(2,2,1);
stem(y1);
grid;
%ramp signal
n=0:0.01:1;
y2=n;
title('ramp');
subplot(2,2,2);
stem(n,y2);
grid;
%exponential
n=0:0.01:1;
y3=exp(n);
title('exponential');
subplot(2,2,3);
stem(n,y3);
grid;

OUTPUT :

ramp exponential
1 1

0.8 0.8

0.6 0.6

0.4 0.4

0.2 0.2

0 0
0 5 10 15 20 0 0.5 1

0
0 0.5 1

RESULT :
Thus the discrete time signals (step, ramp and exponential signals) were
generated using MATLAB software.
EXP NO : 6
VERIFICATION OF SAMPLING THEOREM
DATE :

AIM :
To verify sampling theorem using matlab 7.1.

SOFTWARE REQUIRED :
MATLAB 7.1

ALGORITHM :

Start the program.


Get the input n value from the user.
Assign the range of time axis.
Give the title for the X-axis and Y-axis of the program.
Then plot the square using a discrete value.
End the program.

PROGRAM :

a=2;
ns=20;
f=1000;
fs=ns*f;
ts=1/fs;
T=1/f;
nc=2*T;
t=0:ts:nc;
t1=0:4*ts:nc;
x=a*sin(2*pi*f*t);
x1=a*sin(2*pi*f*t1);
plot(t,x);
hold on
stem(t1,x1);
hold on
plot(t1,x1);
legend('sine','sample','re construct');
OUTPUT :

2
sine
1.5 sample
re construct

0.5

-0.5

-1

-1.5

-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
-3
x 10

RESULT :
Thus the sampling theorem was verified using MATLAB 7.1
software.
EXP NO : 7
LINEAR CONVOLUTION
DATE:

AIM :
To perform the linear convolution of two signals using MATLAB software.

APPARATUS REQUIRED :
MATLAB 7.1

ALGORITHM :

Start the program.


Get the input n and h value from the user.
Assign the range of time axis.
Give the title for the X-axis and Y-axis of the program.
Then plot the sequence as continuous value (or) a discrete value as per
required.
End the program.

PROGRAM :

clc;
clear all;
close all;
x=input('enter the input sequence x(n):');
h=input('enter the pulse sequence h(n):');
y=conv(x,h);
subplot(3,1,1);
stem(x);
xlabel('number of samples-n');
ylabel('input sequence x(n)');
subplot(3,1,2);
stem(h);
xlabel('number of samples-n');
ylabel('impulse sequence h(n)');
subplot(3,1,3);
stem(y);
xlabel('number of samples-n');
ylabel('output response y(n)');
grid;
OUTPUT :
enter the input sequence x(n):[2 4 6]
enter the pulse sequence h(n):[1 3 5]
input sequence x(n)

10

0
1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3
number of samples-n
impulse sequence h(n)

0
1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3
number of samples-n
output response y(n)

40

20

0
1 1.5 2 2.5 3 3.5 4 4.5 5
number of samples-n

RESULT :
Thus the linear convolution of two signals was composed and the output was
obtained using MATLAB software.

EXP NO : 8
CIRCULAR
DATE : CONVOLUTION

AIM :
To perform the circular convolution of two signals using MATLAB software.

SOFTWARE REQUIRED :
MATLAB 7.1

ALGORITHM :

Start the program.


Get the input n and h value from the user.
Assign the range of time axis.
Give the title for the X-axis and Y-axis of the program.
Then plot the sequence as continuous value or discrete value as per required.
End the program.

PROGRAM :
clc;
clear all;
close all;
x=input('enter the input sequence x(n):');
h=input('enter the pulse sequence h(n):');
y=cconv(x,h);
subplot(3,1,1);
stem(x);
xlabel('number of samples-n');
ylabel('input sequence x(n)');
subplot(3,1,2);
stem(h);
xlabel('number of samples-n');
ylabel('impulse sequence h(n)');
subplot(3,1,3);
stem(y);
xlabel('number of samples-n');
ylabel('output sequence y(n)');
grid;
OUTPUT :
enter the input sequence x(n):[1 2 3 1]
enter the pulse sequence h(n):[2 4 5 2]
input sequence x(n)

0
1 1.5 2 2.5 3 3.5 4
number of samples-n
impulse sequence h(n)

0
1 1.5 2 2.5 3 3.5 4
number of samples-n
output sequence y(n)

40

20

0
1 2 3 4 5 6 7
number of samples-n
RESULT :
Thus the circular convolution of two signals was composed and the output was
obtained using MATLAB software.

EXP NO : 9
OVERLAP SAVE METHOD
DATE :

AIM :
To perform the overlap save method of two signals using MATLAB software.

SOFTWARE REQUIRED :
MATLAB 7.1

ALGORITHM :

Start the program.


Get the input n and h value from the user.
Assign the range of time axis.
Give the title for the X-axis and Y-axis of the program.
Then plot the sequence as continuous value (or) a discrete value as per
required.
End the program.

PROGRAM :

clc;
clear all;
x=input('enter the input sequence x(n):');
h=input('enter the impulse response h(n):');
n=length(x);
m=length(h);
N=n+m-1;
h1=[h zeros(1,m-1)];
M1=length(h1);
y=zeros(1,N);
x1=[zeros(1,N-n) x zeros(1,M1)];
H=fft(h1);
for i=1:m:N;
y1=x1(i:i+2*(M1-m));
y2=fft(y1);
y3=H.*y2;
y4=round(ifft(y3));
y(i:(i+(M1-m)))=y4(m:M1);
end;
subplot(3,1,1);
stem(x);
subplot(3,1,2);
stem(h);
subplot(3,1,3);
stem(y);

OUTPUT :
enter the input sequence x(n):[2 4 6]
enter the impulse response h(n):[1 3 5]

0
1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3
6

0
1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3
40

20

0
1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
RESULT :
Thus the overlap save method of two signals was computed and the output was
obtained using MATLAB software.

EXP NO : 10
SPECTRAL ANALYSIS OF DT
DATE :
SIGNALS
AIM :
To perform a spectral analysis of DT signals (sine wave and combined sine wave)
using MATLAB software.

SOFTWARE REQUIRED :
MATLAB 7.1

ALGORITHM :

Start the program.


Get the input n and h value from the user.
Assign the range of time axis.
Give the title for the X-axis and Y-axis of the program.
Then plot the sequence as continuous value (or) a discrete value as per
required.
End the program.

PROGRAM :

clear all;
close all;
clc;
f=0.1;
n=1:32;
x=sin(2*pi*f*n);
x_fft=fft(x,32);
subplot(2,2,1);
stem(abs(x_fft));
xlabel('k');
ylabel('magnitude');
title('spectrum of sine wave');
f1=0.6;
x1=sin(2*pi*f*n)+sin(2*pi*f1*n);
x_fft1=fft(x1,32);
subplot(2,2,2);
stem(abs(x_fft1));
xlabel('k');
ylabel('magnitude');
title('spectrum of combined sine wave');

OUTPUT :

spectrum of sine wave spectrum of combined sine wave


20 20

15 magnitude 15
magnitude

10 10

5 5

0 0
0 10 20 30 40 0 10 20 30 40
k k
RESULT :
Thus the spectral analysis of DT signals (sine wave and combined sine wave)
were performed using MATLAB software.

EXP NO : 11
CALCULATION OF FFT
DATE :

AIM :
To perform the calculation of FFT using MATLAB software.

SOFTWARE REQUIRED :
MATLAB 7.1

ALGORITHM :

Start the program.


Get the input n value from the user.
Assign the range of time axis.
Give the title for the X-axis and Y-axis of the program.
Then plot the sequence as continuous value (or) a discrete value as per
required.
End the program.

PROGRAM :

clc;
close all;
clear all;
x=input ('enter the input sequence');
N=length(x);
y=fft(x,N);
n=0:N-1;
subplot(3,2,1);
stem(n,x);
title('input sequence');
xlabel('n');
ylabel('x(n)');
subplot(3,2,2);
stem(n,y);
title('fft');
xlabel('k');
ylabel('x(k)');
y_mag=abs(y);
subplot(3,2,3);
stem(n,y_mag);
title('magnitude');
xlabel('k');
ylabel('x(k)');
y_phase=angle(y);
subplot(3,2,4);
stem(n,y_phase);
title('phase in radians');
xlabel('k');
ylabel('x(k)');
OUTPUT :

enter the input sequence[2 4 6 8]

input sequence fft


10 20

5 0
x(n)

x(k)

0 -20
0 1 2 3 0 1 2 3
n k
magnitude phase in radians
20 5

10 0
x(k)
x(k)

0 -5
0 1 2 3 0 1 2 3
k k
RESULT :

Thus the calculation of FFT was performed using MATLAB software.

EXP NO : 12
DETERMINATION OF FREQUENCY RESPONSE
DATE :
OF AN LTI SYSTEM
AIM :
To perform the frequency response of an LTI system using MATLAB software .

SOFTWARE REQUIRED :
MATLAB 7.1

ALGORITHM :

Start the program.


Get the input value from the user.
Assign the range of time axis.
Give the title for the axis X-axis and Y-axis of the program.
Then plot the sequence as magnitude value (or) a phase radian value as per
required.
End the program.

PROGRAM :

clc;
clear all;
close all;
b=[3-5];
a=[1,38];
H=freqs(b,a);
subplot(2,1,1);
plot(abs(H));
title('magnitude response');
xlabel('frequency');
ylabel('amplitude');
subplot(2,1,2);
plot(angle(H));
title('phase response');
xlabel('frequency-x');
ylabel('phase in radians');

OUTPUT :

magnitude response
0.06

0.04
amplitude

0.02

0
0 20 40 60 80 100 120 140 160 180 200
frequency
phase response
3.5

3
phase in radians

2.5

1.5
0 20 40 60 80 100 120 140 160 180 200
frequency-x
RESULT :

Thus the frequency response of an LTI system computed and the output was
obtained using MATLAB software.

EXP NO : 13
DESIGN OF IIR BUTTERWORTH
DATE : FILTER
USING LOW PASS FILTER

AIM :
To design an IIR butterworth filter using low pass filter using MATLAB software.

SOFTWARE REQUIRED :
MATLAB 7.1

ALGORITHM :

Start the program.


Get the input value from the user.
Assign the range of time axis.
Give the title for X-axis and Y-axis of the program.
Then plot the sequence as magnitude value (or) a phase response value as
per required.
End the program.

PROGRAM :

clc;
clear all;
close all;
N=512;
n=6;
fc=input('enter the cut off frequency:');
fs=input('enter the sampling frequency:');
Wc=2*fc/fs;
[b,a]=butter(n,Wc,'low');
freqz(b,a,N,fs);
title('magnitude and phase response of butterworth IIR low pass
filter');

OUTPUT :

enter the cut off frequency: 1200


enter the sampling frequency: 3000

magnitude and phase response of butterworth IIR low pass filter


0
Magnitude (dB)

-100

-200

-300
0 500 1000 1500
Frequency (Hz)

0
Phase (degrees)

-200

-400

-600
0 500 1000 1500
Frequency (Hz)
RESULT :

Thus the IIR butterworth filter using the low pass filter was designed and the
output was plotted using MATLAB software.

EXP NO : 14
DESIGN OF IIR BUTTERWORTH FILTER
DATE : USING
IMPULSE INVARIANT
TECHNIQUE

AIM :
To design an IIR butterworth filter using impulse invariant technique using
MATLAB software.

SOFTWARE REQUIRED :
MATLAB 7.1

ALGORITHM :

Start the program.


Get the input value from the user.
Assign the range of time axis.
Give the title for the X-axis and Y-axis of the program.
Then plot the sequence as magnitude value (or) a phase response value as
per required.
End the program.

PROGRAM :

clc;
clear all;
close all;
Rp=input('enter the pass band attenuation:');
Rs=input('enter the stop band attenuation:');
Wp=input('enter the pass band frequency:');
Ws=input('enter the stop band frequency:');
[N,Wn]=buttord(Wp,Ws,Rp,Rs);
display(N);
[b,a]=butter(N,Wn);
display(b);
display(a);
fs=1;
[Bz,Az]=impinvar(b,a,fs);
display(Bz);
display(Az);
H=freqz(Bz,Az);
m=20*log(abs(H));
subplot(2,1,1);
plot(m);
title('magnitude response');
xlabel('W');
ylabel('amplitude in db');
subplot(2,1,2);
plot(angle(H));
title('phase response');
xlabel('W');
ylabel('phase in radians');
OUTPUT :
enter the pass band attenuation: 2
enter the stop band attenuation: 14
enter the pass band frequency: 0.1*pi
enter the stop band frequency: 0.2*pi

N=2
b = 0.1918 0.3836 0.1918
a = 1.0000 -0.4386 0.2058
Bz = 0.6595 -0.6684 0.2974
Az = 1.0000 -2.2967 1.5506
magnitude response
amplitude in db 10

-10

-20

-30
0 100 200 300 400 500 600
W
phase response
4
phase in radians

-2

-4
0 100 200 300 400 500 600
W

RESULT :

Thus the IIR butterworth filter using impulse invariant method was designed and
the output was plotted successfully.

EXP NO :
15 DESIGN OF IIR BUTTERWORTH FILTER
DATE:
USING
BILINEAR TRANSFORMATION
TECHNIQUE

AIM :
To design an IIR butterworth filter using bilinear transformation technique using
MATAB software.

SOFTWARE REQUIRED :
MATLAB 7.1

ALGORITHM:
Start the program.
Get the input value from the user.
Assign the range of time axis.
Get the title for X-axis and Y-axis of the program.
Then plot the sequence as magnitude value (or) phase response value as per
required.
End the program.

PROGRAM :

clc;
clear all;
close all;
Rp=input('enter the pass band attenuation:');
Rs=input('enter the stop band attenuation:');
Wp=input('enter the pass band frequency:');
Ws=input('enter the stop band frequency:');
[N,Wn]=buttord(Wp,Ws,Rp,Rs);
display(N);
[b,a]=butter(N,Wn);
display(b);
display(a);
fs=1;
[Bz,Az]=bilinear(b,a,fs);
display(Bz);
display(Az);
H=freqz(Bz,Az);
m=20*log(abs(H));
subplot(2,1,1);
plot(m);
title('magnitude response');
xlabel('W');
ylabel('amplitude in db');
subplot(2,1,2);
plot(angle(H));
title('phase response');
xlabel('W');
ylabel('phase in radians');
OUTPUT :
enter the pass band attenuation:2
enter the stop band attenuation:14
enter the pass band frequency:0.1*pi
enter the stop band frequency:0.2*pi

N= 2
b = 0.1918 0.3836 0.1918
a = 1.0000 -0.4386 0.2058
Bz = 0.5186 -0.3457 0.0576
Az = 1.0000 -2.2798 1.5271

magnitude response
20
amplitude in db

-20

-40
0 100 200 300 400 500 600
W
phase response
4

2
phase in radians

-2

-4
0 100 200 300 400 500 600
W

RESULT :
Thus the IIR butterworth filter using bilinear transformation technique was
designed and the output was plotted using MATLAB software.

EXP NO : 16
DESIGN OF IIR CHEBYSHEV FILTER
DATE :
USING
IMPULSE INVARIANT
TECHNIQUE

AIM :
To design an IIR chebyshev filter using impulse invariant technique using matlab
software.

APPARATUS REQUIRED :
MATLAB 7.1

ALGORITHM :
Start the program.
Get the input value from the user.
Assign the range of time axis.
Give the title for X-axis and Y-axis of the program.
Then plot the sequence as magnitude value (or) phase response value as per
required.
End the program.

PROGRAM :
clc;
clear all;
close all;
Rp=input('enter the pass band attenuation:');
Rs=input('enter the stop band attenuation:');
Wp=input('enter the pass band cut-off frequency:');
Ws=input('enter the stop band frequency:');
T=1;
owep=(2/T)*tan((Wp/2));
owes=(2/T)*tan((Ws/2));
[N,Wn]=cheb1ord(Wp,Ws,Rp,Rs);
display(N);
[B,A]=cheby1(N,Rp,Wp);
display(A);
display(B);
[bz,az]=impinvar(B,A,1/T);
display(bz);
display(az);
W=0:0.01:pi;
H=freqz(bz,az,W);
subplot(2,1,1);
plot(W/pi,abs(H));
title('magnitude response');
xlabel('W-frequency');
ylabel('amplitude');
grid;
subplot(2,1,2);
plot(W/pi,angle(H));
title('phase response');
xlabel('W-frequency');
ylabel('phase');
grid;
OUTPUT :

enter the pass band attenuation : 4


enter the stop band attenuation : 18
enter the pass band cut-off frequency : 0.1*pi
enter the stop band cut-off frequency : 0.2*pi

N = 2
A = 1.0000 -1.1027 0.6081
B = 0.0797 0.1595 0.0797
Bz = 0.3271 -0.3250 0.2402
az = 1.0000 -2.9566 3.0122

magnitude response
0.4

0.3
amplitude

0.2

0.1

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
W-frequency
phase response
4

2
phase

-2

-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
W-frequency

RESULT :

Thus the chebyshev filter using impulse invariant technique was designed and the
output was plotted usinh the MATLAB software.
EXP NO : 17
DESIGN OF IIR CHEBYSHEV FILTER
DATE : USING
BILINEAR TRANSFORMATION
TECHNIQUE

AIM :
To design an chebyshev filter using bilinear transformation technique using
MATLAB software.

SOFTWARE REQUIRED :
MATLAB 7.1

ALGORITHM :
Start the program.
Get the input value from the user.
Assign the range of time axis.
Give the title for the X-axis and Y-axis of the program.
Then plot the sequence as magnitude value (or) phase response value as per
required.
End the program.

PROGRAM :
clc;
clear all;
close all;
Rp=input('enter the pass band attenuation:');
Rs=input('enter the stop band attenuation:');
Wp=input('enter the pass band cut-off frequency:');
Ws=input('enter the stop band cut-off frequency:');
T=1;
owep=(2/T)*tan((Wp/2));
owes=(2/T)*tan((Ws/2));
[N,Wn]=cheb1ord(Wp,Ws,Rp,Rs);
display(N);
[B,A]=cheby1(N,Rp,Wp);
display(A);
display(B);
[bz,az]=bilinear(B,A,1/T);
display(bz);
display(az);
W=0:0.01:pi;
H=freqz(bz,az,W);
subplot(2,1,1);
plot(W/pi,abs(H));
title('magnitude response');
xlabel('W-frequency');
ylabel('amplitude');
grid;
subplot(2,1,2);
plot(W/pi,angle(H));
title('phase response');
xlabel('W-frequency');
ylabel('phase');
grid;

OUTPUT :
enter the pass band attenuation:4
enter the stop band attenuation:18
enter the pass band cut-off frequency:0.1*pi
enter the stop band cut-off frequency:0.2*pi

N = 2
A = 1.0000 -1.1027 0.6081
B = 0.0797 0.1595 0.0797
bz = 0.2986 -0.1991 0.0332
az = 1.0000 -2.8234 2.8357

magnitude response
0.25

0.2
amplitude

0.15

0.1

0.05
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
W-frequency
phase response
4

2
phase

-2

-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
W-frequency

RESULT :
Thus the chebyshev filter using bilinear transformation technique was designed
and the output was plotted using MATLAB software.

EXP NO :
18 DESIGN OF FIR FILTER USING WINDOWS
DATE:

AIM :
To design a finite impulse response (FIR) filter using hamming window technique
and to plot its frequency response.

SOFTWARE REQUIRED :
MATLAB 7.1

ALGORITHM :

Calculate the cut-off frequency.


Enter the length of an FIR filter.
Calculate the phase delay.
Enter the eps constant value and the range of values for n .
Determine the infinite impulse response using phase delay, eps and n
values.
Display the order and analog co-efficients.
Convert the analog filter into a digital filter using bilinear function.
Display the co-efficients of digital filter.
Find the frequency response using freqz function.
Plot the magnitude and phase response using abs and angle functions.

PROGRAM :

clear all;
Wc=0.5*pi;
N=25;
b=fir1(N,Wc/pi,hamming(N+1));
W=0:0.01:pi;
h=freqz(b,1,W);
plot(W/pi,abs(h));
hold on;
b=fir1(N,Wc/pi,blackman(N+1));
W=0:0.01:pi;
h=freqz(b,1,W);
plot(W/pi,abs(h));
grid;
xlabel('normalised frequency/omega/\pi');
ylabel('magnitude');
%hold off
OUTPUT :

1.4

1.2

0.8
magnitude

0.6

0.4

0.2

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
normalised frequency/omega/

RESULT :
Thus the FIR filter was designed using hamming and blackmannis done and
verified using MATLAB software.

Você também pode gostar