0% found this document useful (0 votes)
28 views41 pages

DSP Manual Merged

The document outlines the practical work for the EE3024 Digital Signal Processing System Design course at SRM TRP Engineering College, detailing the course objectives, outcomes, and student responsibilities. It includes a bonafide certificate, vision and mission statements for the institute and department, as well as program educational objectives and specific outcomes. Additionally, it provides a syllabus with laboratory exercises and coding examples for various digital signal processing techniques using MATLAB.

Uploaded by

Vithyathar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views41 pages

DSP Manual Merged

The document outlines the practical work for the EE3024 Digital Signal Processing System Design course at SRM TRP Engineering College, detailing the course objectives, outcomes, and student responsibilities. It includes a bonafide certificate, vision and mission statements for the institute and department, as well as program educational objectives and specific outcomes. Additionally, it provides a syllabus with laboratory exercises and coding examples for various digital signal processing techniques using MATLAB.

Uploaded by

Vithyathar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Department of Electrical and Electronics Engineering

EE3024 – DIGITAL SIGNAL PROCESSING SYSTEM DESIGN

RECORD

Name of the student :

Register number :

Year/ Semester : III/ 06


SRM TRP ENGINEERING COLLEGE
(SRM GROUP)
Irungalur, Tiruchirappalli-621 105
Approved by AICTE, New Delhi
Affiliated to Anna University, Chennai.

Department of Electrical and Electronics Engineering

BONAFIDE CERTIFICATE

This is to certify that this practical work titled EE3024- Digital System Processing

System Design is the bonafide work of …………………………………….

Registration Number ……………………

Staff-in-charge Head of the department

Submitted for the Anna University Practical Examination held on ………………… at


SRM TRP Engineering College, Tiruchirappalli – 621 105.

INTERNAL EXAMINER EXTERNAL EXAMINER


SRM TRP Engineering College
Vision and Mission - Institute
Vision
To carve the youth as dynamic competent, valued and knowledgeable Technocrats through research,
innovation and entrepreneurial development for accomplishing the global expectations.
Mission
M1: To inculcate the academic excellence in engineering education to create talented professionals.
M2: To promote research in basic sciences and applied engineering among faculty and students to fulfill the
societal expectation.
M3: To enhance the Holistic development of students through meaningful interaction with industry and
academia.
M4: To foster the students on par with sustainable development goals thereby contributing to the process of
nation building.
M5: To nurture and retain conducive lifelong learning environment towards professional excellence.

Vision and Mission - Department of Electrical and Electronics Engineering


Vision

To make certain transformational impact on student community towards learning, innovating, discovering
and creating new knowledge with respect to the field of electrical and electronics engineering and serve the
country, humanity as well as society at large.
Mission
M1: To provide well equipped infrastructure and facilities to produce electrical engineers of high caliber
to serve the society.
M2: To create an ethical human resource proficient with knowledge and attitude for meeting future
needs.
M3: To instill creative thinking among students through training and interaction with industries to
become a successful professional.
M4: To provide state-of-the-art resources that contribute to achieve excellence in research and
development activities.
M5: To facilitate individual and team activities to enhance personality and soft skills to allow them to
grow in diversified fields of their careers as professional engineers, researchers, scientists or teachers
SRM TRP Engineering College
Department of Electrical and Electronics Engineering

1. PROGRAMME EDUCATIONAL OBJECTIVES (PEOs):

I. Find employment in Core Electrical and Electronics Engineering and service sectors.
II. Get elevated to technical lead position and lead the organization competitively.
III. Enter into higher studies leading to post-graduate and research degrees.
Become consultant and provide solutions to the practical problems of core
organization.
IV. Become an entrepreneur and be part of electrical and electronics product and service
industries.

2. PROGRAMME OUTCOMES (POs):

After going through the four years of study, our Electrical and Electronics Engineering
Graduates will exhibit ability to:

PO Graduate Attribute Programme Outcome

Apply knowledge of mathematics, basic science and


1 Engineering knowledge
engineering science.
2 Problem analysis Identify, formulate and solve engineering problems.
Design/development of Design an electrical system or process to improve its
3
solutions performance, satisfying its constraints.
Conduct investigations Conduct experiments in electrical and electronics systems
4
of complex problems and interpret the data.
Apply various tools and techniques to improve the
5 Modern tool usage
efficiency of the system.
The Engineer and Conduct themselves to uphold the professional and social
6
society obligations.
Environment and Design the system with environment consciousness and
7
sustainability sustainable development.
Interacting industry, business and society in a
8 Ethics
professional and ethical manner.
Individual and team
9 Function in a multidisciplinary team.
work
10 Communication Proficiency in oral and written Communication.
Project management
11 Implement Cost effective and improved system.
and finance
Continue professional development and learning as a
12 Life-long learning
life-long activity.

3. PROGRAM SPECIFIC OUTCOMES (PSOs):

On completion of Electrical and Electronics Engineering program, the student will have the
following Program Specific Outcomes.

I. Foundation of Electrical Engineering:


Ability to understand the principles and working of electrical components, circuits, systems
and control that are forming a part of power generation, transmission, distribution,
utilization, conservation and energy saving. Students can assess the power management,
auditing, crisis and energy saving aspects.
II. Foundation of Mathematical Concepts:
Ability to apply mathematical methodologies to solve problems related with electrical
engineering using appropriate engineering tools and algorithms.
III. Computing and Research Ability:
Ability to use knowledge in various domains to identify research gaps and hence to provide
solution which leads to new ideas and innovations.
SYLLABUS

EE3024 DIGITAL SIGNAL PROCESSING SYSTEM DESIGN LTPC


2 0 2 3
COURSE OBJECTIVES:
• To introduce the concept of analyzing discrete time signals & systems in the time and
• frequency domain through mathematical representation.
• To study the various time to frequency domain transformation techniques.
• To Understand the computation algorithmic steps for Fourier Transform.
• To study about filters and their design for digital implementation.
• To introduce the programmable digital signal processor & its application.

1. Laboratory exercise:
Use any DSP processor/MATLAB/open source platform to give hands on training on
basic concepts of Digital Signal Processing
a) To determine impulse and step response of two vectors
b) To perform convolution between two vectors .
c) To compute DFT and IDFT of a given sequence.
d) To perform linear convolution of two sequence using DFT
e) Design and Implementation of FIR Filter
f) Design and Implementation of IIR Filter
g) To determine z-transform from the given transfer function and its ROC
2. Assignment: Implementation of FIR/IIR filter with FPGA.
3. DSP processors based Mini project.
TOTAL: 30 PERIODS
COURSE OUTCOMES:
At the end of this course, the students will have the ability to
CO1: Explain the concepts of digital signal processing
CO2: Illustrate the system representation using transforms
CO3: Learn the transformation techniques for time to frequency conversion
CO4: Design suitable digital FIR, IIR algorithm for the given specification
CO5: Use digital signal processor for application demonstration

Mapping of COs with POs and PSOs

PO PSO
COs
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2 PSO3
CO1 1 3 2 2 1 - - - - - - - 1 2 1
CO2 2 3 3 2 2 - - - - - - - 2 3 1
CO3 3 3 3 3 3 - - - - - - - 2 2 2
CO4 3 3 3 3 3 - - - - - - - 2 2 3
CO5 3 3 3 3 1 - - - 1 - - - 2 2 3
2.4 3 2.8 2.4 2 - - - 1 - - - 1.8 2.2 2
STUDENT RESPONSIBILITIES

➢ The student is expected to be prepared for each lab.


• Lab preparation includes reading the lab experiment and related textbook
material.
• In addition to this, the lab pre-laboratory preparation may consist of performing
theoretical calculations that you will need during the lab. (To be completed before
entering the lab)
If you have questions or problems with the preparation, contact the Faculty in–Charge, in
timely manner.
➢ Active participation by each student in lab activities is expected.
➢ Get the diagram/model approved and simulate. Get the output verified.
➢ Write the inference for all experiments in the observation note. If not, marks for
concerned observation will be proportionately reduced.
➢ The students are strictly instructed to get the observation note corrected within two days
from the date of completion of experiment.
➢ He/she is also responsible for keeping a professional and accurate record of the lab
experiments in a laboratory notebook. Submit the corrected record note book for the
completed experiment during the next lab session.
➢ A student's grade is determined by the comprehensive final university exam, so
understanding the concepts and procedure of each experiment is necessary for successful
completion of the lab. The student should be alert while performing the lab experiment.
➢ Attendance is mandatory and any absence must be for a valid excuse. In case of missing
any practical class due to unavoidable reasons, intimate the staff in charge and do the
missed experiment in the next lab class.
➢ It is the sole responsibility of the individual to adhere to the schedule planned and complete
the experiments.
INDEX

Ex. Page
Date Name of the experiment Marks Sign
No. No.
To determine impulse and step response of
1a.
two vectors

1b. To perform convolution between two vectors

To compute DFT and IDFT of a given


1c.
sequence.
To perform linear convolution of two sequence
1d.
using DFT

1e. Design and Implementation of FIR Filter

1f. Design and Implementation of IIR Filter

To determine z-transform from the given


1g.
transfer function and its ROC
Ex. No. 1a IMPULSE AND STEP RESPONSE
Date:

Aim:

To determine the impulse and step response of the vectors using MATLAB

Coding:

sys = tf([1], [1 1]); % Transfer function: 1/(s+1)

% Impulse Response
[y, t] = impulse(sys);
stem(t, y);
xlabel('Time');
ylabel('Response');
title('Impulse Response');
grid on;

% Step Response
[y, t] = step(sys);
figure; % Create a new figure
stem(t, y);
xlabel('Time');
ylabel('Response');
title('Step Response');
grid on;

1
OUTPUT:

Result:
The impulse and step response of any given vector is obtained using MATLAB.
2
Ex. No. 1b LINEAR AND CIRCULAR CONVOLUTIONS
Date:

Aim:
To perform Linear and Circular convolution of two given sequences using
MATLAB.

Algorithm:
1. Get the values for the Input sequence x(n).
2. Get the values for the Impulse sequence h(n).
3. Perform the Linear and Circular convolution of x(n) and h(n).
4. Plot the Input sequence x(n) and Impulse sequence h(n).
5. Plot the Linear and Circular convolution sequences X(k).
6. Specify suitable X-axis and Y-axis label.
7. Specify suitable title for the signal.
8. If needed, Grid can be turned on.

Coding:

% Define two vectors


u = [1 2 3];
v = [4 5 6];

% Perform convolution
w = conv(u, v);

% Display the result


disp(w);

Output:
Code

4 13 27 24 18

3
%PROGRAM FOR LINEAR CONVOLUTION
clc;
clear;
x=input('ENTER THE INPUT SEQUENCE x(n):');
h=input('ENTER THE IMPULSE SEQUENCE h(n):');
y=conv(x,h);
subplot(3,1,1);
stem(x);

xlabel('n--- >');
ylabel('x(n)--- >');

title('INPUT SEQUENCE x(n)');


grid on;
subplot(3,1,2);
stem(h);
xlabel('n --- >');
ylabel('h(n)--- >');
title('IMPULSE SEQUENCE h(n)');
grid on;
subplot(3,1,3);
stem(y);
xlabel('n --- >');
ylabel('y(n)--- >');
title('LINEAR CONVOLUTION OF x(n) and h(n)');
grid on;
disp(x);
disp(h);
disp(y);

4
Output:
ENTER THE INPUT SEQUENCE x(n): [1 1 2 2]
ENTER THE IMPULSE SEQUENCE h(n): [1 2 3 4]
1 1 2 2

1 2 3 4

1 3 7 13 14 14 8

5
%PROGRAM FOR CIRCULAR CONVOLUTION
clc;
clear;
x=input('ENTER THE INPUT SEQUENCE x(n):');
h=input('ENTER THE IMPULSE SEQUENCE h(n):');
x1=fft(x);
h1=fft(h);
N=length(x);
for n=1:N
y1(n)=x1(n)*h1(n);
end y=ifft(y1);
subplot(3,1,1);
stem(x);
xlabel('n --- >');
ylabel('x(n)--- >');
title('INPUT SEQUENCE x(n)');
grid on;
subplot(3,1,2);
stem(h);
xlabel('n --- >');
ylabel('h(n)--- >');
title('IMPULSE SEQUENCE h(n)');
grid on;
subplot(3,1,3);
stem(y);
xlabel('n --- >');
ylabel('y(n)--- >');
title('CIRCULAR CONVOLUTION OF x(n) and h(n)');
grid on;
disp(x);
disp(h);
disp(y);

6
Output:
ENTER THE INPUT SEQUENCE x(n):[1 1 2 2]
ENTER THE IMPULSE SEQUENCE h(n):[1 2 3 4]
1 1 2 2

1 2 3 4

15 17 15 13

Result:
Thus the Linear and Circular convolution of two given sequences was performed using
MATLAB.

7
Ex. No. 1c DFT and IDFT OF GIVEN SEQUENCE
Date:

Aim:

To find the DFT/IDFT of a sequence using MATLAB.

Algorithm:
1. Get the values for the Input sequence.
2. Calculate the length of the sequence.
3. Find the DFT of the sequence (Xk)
4. Find the magnitude and phase response for Xk.
5. Find the Idft of the sequence Xk.
6. Plot the Input sequence x(n)
7. Plot the Magnitude of DFT sequence.
8. Plot the Phase of DFT Sequence.
9. Plot the IDFT sequence.

%PROGRAM TO FIND THE DFT/IDFT OF A SEQUENCE WITHOUT USING THE


INBUILT FUNCTIONS
Clc;
close all;
clear all;
xn=input('Enter the sequence x(n)'); %Get the sequence from user
ln=length(xn); %find the length of the sequence

xk=zeros(1,ln); %initilise an array of same size as that of input sequence

ixk=zeros(1,ln); %initilise an array of same size as that of input sequence

%code block to find the DFT of the sequence %


for k=0:ln-1
for n=0:ln-1
xk(k+1)=xk(k+1)+(xn(n+1)*exp((-i)*2*pi*k*n/ln));
end
end
%code block to plot the input sequence %

8
t=0:ln-1;
subplot(3,2,1);
stem(t,xn);
grid
ylabel ('Amplitude');
xlabel ('Time Index');
title('Input Sequence');
t=0:ln-1;
subplot(3,2,2);
stem(t,xk);
grid
ylabel ('Amplitude');
xlabel ('Time Index');
title('Input Sequence');
%code block to plot the magnitude response %
magnitude=abs(xk);
t=0:ln-1;
subplot(3,2,3);
stem(t,magnitude);
grid
ylabel ('Amplitude'); xlabel ('K');
title ('Magnitude Response');
%code block to plot the magnitude sequence %
phase=angle(xk);
t=0:ln-1;
subplot(3,2,4);
stem(t,phase);
grid
ylabel ('Phase');
xlabel ('K');
title('Phase Response');
% Code block to find the IDFT of the sequence %
for n=0:ln-1; for k=0:ln-1;
ixk(n+1)=ixk(n+1)+(xk(k+1)*exp(i*2*pi*k*n/ln));
9
end

end
ixk=ixk./ln;
%code block to plot the input sequence %
t=0:ln-1;
subplot(3,2,5);
stem(t,xn);
grid;
ylabel ('Amplitude');
xlabel ('Time Index');
title ('IDFT sequence');

10
OUTPUT:

Enter the sequence x(n) [1 2 3 4]


Output waveform

11
Using fft and ifft functions
% Input sequence of length 5
x = [1, 2, 3, 4, 5];

% DFT of x
X = fft(x);

% IDFT of X
x_recovered = ifft(X);

% Display the results


X
x_recovered

RESULT:
The DFT/IDFT of a sequence found using MATLAB.

12
Ex. No. 1d CONVOLUTION USING DFT
Date:

Aim:

To perform Linear and Circular convolution using DFT

Software:

MATLAB

Coding:

x = [2 1 2 1];

y = [1 2 3];
clin = conv(x,y);

The output has length 4+3-1.

Pad both vectors with zeros to length 4+3-1. Obtain the DFT of both vectors, multiply the DFTs,
and obtain the inverse DFT of the product.

Get

xpad = [x zeros(1,6-length(x))];

ypad = [y zeros(1,6-length(y))];

ccirc = ifft(fft(xpad).*fft(ypad));

The circular convolution of the zero-padded vectors, xpad and ypad, is equivalent to the linear
convolution of x and y. You retain all the elements of ccirc because the output has length 4+3-1.
Plot the output of linear convolution and the inverse of the DFT product to show the equivalence.

Get
subplot(2,1,1)

stem(clin,'filled')

ylim([0 11])

title('Linear Convolution of x and y')

subplot(2,1,2)

stem(ccirc,'filled')

ylim([0 11])
title('Circular Convolution of xpad and ypad')
13
Output:

Result:

Linear and Circular convolution using DFT is done in MATLAB.

14
Ex. No. 1e DESIGN AND IMPLEMENTATION OF FIR FILTER
Date:

Aim:
To design FIR Filter by windowing Technique using MATLAB R2012a.

Window techniques:
1. Get the passband and stopband frequencies in rad/sec.
2. Get the order of the filter and the Sampling Frequency.
3. Design a FIR LPF, HPF, BPF, BSF using suitable window function.
4. Plot the Frequency response of the filter.
5. Specify suitable X-axis and Y-axis label.
6. Specify suitable title for the signal.
7. If needed, Grid can be turned on.

15
% PROGRAM FOR FIR FILTER DESIGN USING DIFFERENT
WINDOWING TECHNIQUES
clear all;
rp=input('Enter the PB ripple rp =');
rs=input('Enter the SB ripple rs =');
fp=input('Enter the PB ripple fp =');
fs=input('Enter the SB ripple fs =');
f=input('Enter the sampling frequency f =');
wp=2*fp/f;
ws=2*fs/f;
num=-20*log10(sqrt(rp*rs))-13;
den=14.6*(fs-fp)/f;
n=ceil(num/den);
n1=n+1;
if(rem(n,2)~=0)
n=n1;
n=n-1; end;
y=boxcar(n1);
%LPF
b=fir1(n,wp,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,1);
plot(o/pi,m);
xlabel('Normalized frequency ------ >');
ylabel('Gain in db ----- --.');
title('MAGNITUDE RESPONSE OF LPF');
%HPF
b=fir1(n,wp,'high',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,2);
plot(o/pi,m);

16
xlabel('Normalized frequency ------ >');
ylabel('Gain in db ----- --.');
title('MAGNITUDE RESPONSE OF HPF');
%BPF wn=[wp
ws]; b=fir1(n,wn,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,3);
plot(o/pi,m);
xlabel('Normalized frequency ------ >');
ylabel('Gain in db ----- --.');
title('MAGNITUDE RESPONSE OF BPF');
%BSF
b=fir1(n,wn,'stop',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,4);
plot(o/pi,m);
xlabel('Normalized frequency ------ >');
ylabel('Gain in db ----- --.');
title('MAGNITUDE RESPONSE OF BSF');

17
OUTPUT: (Rectangular Window)

Enter the PB ripple rp =.03


Enter the SB ripple rs =.05
Enter the PB ripple fp =2000
Enter the SB ripple fs =3000
Enter the sampling frequency f =9000

18
PROGRAM: (Hanning Window)
clear all;
rp=input('Enter the PB ripple rp =');
rs=input('Enter the SB ripple rs =');
fp=input('Enter the PB ripple fp =');
fs=input('Enter the SB ripple fs =');
f=input('Enter the sampling frequency f =');
wp=2*fp/f;
ws=2*fs/f;
num=-20*log10(sqrt(rp*rs))-13;
den=14.6*(fs-fp)/f;
n=ceil(num/den);
n1=n+1;
if(rem(n,2)~=0)
n=n1;
n=n-1; end;
y=hanning(n1);
%LPF
b=fir1(n,wp,y);
[h,O]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,1);
plot(O/pi,m);
xlabel('Normalized freqency ------>');
ylabel('Gain in db ----- --.');
title('MAGNITUDE RESPONSE OF LPF');
%HPF
b=fir1(n,wp,'high',y);
[h,O]=freqz(b,1,256);
m=20*log10(abs(h));

19
subplot(2,2,2);
plot(O/pi,m);
xlabel('Normalized freqency ------>');
ylabel('Gain in db ----- --.');
title('MAGNITUDE RESPONSE OF HPF');
%BPF wn=[wp ws];
b=fir1(n,wn,y);
[h,O]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,3);
plot(O/pi,m);
xlabel('Normalized freqency ------>');
ylabel('Gain in db ----- --.');
title('MAGNITUDE RESPONSE OF BPF');
%BSF
b=fir1(n,wn,'stop',y);
[h,O]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,4);
plot(O/pi,m);
xlabel('Normalized freqency ------>');
ylabel('Gain in db ----- --.');
title('MAGNITUDE RESPONSE OF BSF');

20
OUTPUT: (Hanning Window)

Enter the PB ripple rp =.03


Enter the SB ripple rs =.02
Enter the PB ripple fp =1500
Enter the SB ripple fs =2000
Enter the sampling frequency f =9000

Result:
The FIR Filter was designed by windowing Technique using MATLAB.

21
Ex. No. 1f DESIGN AND IMPLEMENTATION OF IIR FILTER
Date:

Aim:
To design IIR Filter by Bilinear and Impulse Invariant Transformation Methods
using MATLAB R2012a.

Algorithm:
1. Get the passband and stopband frequencies in rad/sec.
2. Get the passband and stopband ripples in dB.
3. Get the Sampling Frequency.
4. Compute the order of the filter.
5. Obtain the numerator and denominator coefficients of the filter function.
6. Plot the Frequency response of the filter using Bilinear and Impulse Invariant
Transformation.
7. Specify suitable X-axis and Y-axis label.
8. Specify suitable title for the signal.
9. If needed, Grid can be turned on.

22
PROGRAM: (IIR Butterworth Filter using Impulse Method)

N=input('ENTER THE FILTER ORDER N = ');


fs=input('ENTER THE SAMPLING FREQUENCY fs = ');
fc=input('ENTER THE CUT-OFF FREQUENCY fc = ');
wc=2*pi*fc;
[na,da]=butter(N,wc,'s');
[n,d]=impinvar(na,da,fs);
[h,f]=freqz(n,d,512,fs);
gain=20*log10(abs(h));
subplot(2,1,1);
plot(f,gain);
xlabel('Frequency--- >');
ylabel('Magnitude --- >');
title('AMPLITUDE RESPONSSE');
subplot(2,1,2);
zplane(n,d);
z=roots(n); p=roots(d);
xlabel('Real part --->');
ylabel('Imaginary part --->');
title('POLE-ZERO PLOT');

23
OUTPUT: (IIR Butterworth Filter using Impulse Method)

ENTER THE FILTER ORDER N = 2


ENTER THE SAMPLING FREQUENCY fs = 1280
ENTER THE CUT-OFF FREQUENCY fc = 150

24
PROGRAM: (IIR Butterworth Using Bilinear Transformation)
wp=input('ENTER THE PASSBAND EDGE FREQUENCIES wp= ');
ws=input('ENTER THE STOPBAND EDGE FREQUENCIES ws= ');
rp=input('ENTER THE PASSBAND RIPPLE rp= ');
rs=input('ENTER THE STOPBAND RIPPLE rs= ');
fs=input('ENTER THE SAMPLING FREQUENCY fs= ');
wpn=wp/(fs/2); wsn=ws/(fs/2);
[N,fc]=buttord(wpn,wsn,rp,rs);
disp('ORDER OF THE FILTER');
disp(N);
[n,d]=butter(N,wpn);
[h,f]=freqz(n,d,512,fs);
gain=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
plot(f,gain);
xlabel('FREQUENCY --- >');
ylabel('MAGNITUDE');
title('AMPLITUDE RESPONSE');
subplot(2,1,2);
zplane(n,d);
z=roots(n);
p=roots(d);
xlabel('REAL PART --- >');
ylabel('IMAGINARY PART');
title('POLE-ZERO PLOT');

25
INPUT: (IIR Butterworth Using Bilinear Transformation)
Enter the passband edge frequencies wp= [200 300]
Enter the stopband edge frequencies ws= [50 450]
Enter the passband ripple rp= 3
Enter the stopband ripple rs= 20
Enter the sampling frequency fs= 1000
Order of the filter 2

26
PROGRAM: (Chebyshev Type 1 Band pass Filter)
clear all;
alphap=2; %pass band attenuation in dB
alphas=20; %stop band attenuation in dB
wp=[.2*pi,.4*pi];
ws=[.1*pi,.5*pi];
%To find cutoff frequency and order of the filter
[n,wn]=buttord(wp/pi,ws/pi,alphap,alphas);
%system function of the filter
[b,a]=cheby1(n,alphap,wn);
w=0:.01:pi;
[h,ph]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
plot(ph/pi,m);
grid;
ylabel('Gain in dB..');
xlabel('Normalised frequency..');
subplot(2,1,2);
plot(ph/pi,an);
grid;
ylabel('Phase in radians..');
xlabel('Normalised frequency..');

27
OUTPUT: (Chebyshev Type 1 Band pass Filter)

28
PROGRAM: (Chebyshev II Band Reject Filter)
clear all;
alphap=2; %pass band attenuation in dB
alphas=20; %stop band attenuation in dB
ws=[.2*pi,.4*pi];
wp=[.1*pi,.5*pi];
%To find cutoff frequency and order of the filter
[n,wn]=cheb2ord(wp/pi,ws/pi,alphap,alphas);
%system function of the filter
[b,a]=cheby2(n,alphas,wn,'stop');
w=0:.01:pi;
[h,ph]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
plot(ph/pi,m);
grid;
ylabel('Gain in dB..');
xlabel('Normalised frequency..');
subplot(2,1,2);
plot(ph/pi,an);
grid;
ylabel('Phase in radians..');
xlabel('Normalised frequency..');

29
OUTPUT: (Chebyshev II Band Reject Filter)

Result:
The Butterworth and Chebyshev IIR Filter were designed using MATLAB.

30
Ex. No. 1g Z-TRANSFORM AND ROC FROM TRANSFER
Date: FUNCTION

Aim:

To determine Z-transform and its ROC from given transfer function.

Coding:
To find the z-transform of a given transfer function and its Region of Convergence (ROC) in
MATLAB, ztrans and iztrans functions for the z-transform and inverse z-transform,
respectively can be used. The ROC is determined based on the poles of the z-transform.

% Example transfer function H(z) = 1/(z - 0.8)


num = 1;
den = [1, -0.8];
H = tf(num, den, 1); % '1' specifies a discrete-time transfer function

% Use ztrans to find the z-transform


[num_z, den_z] = ztrans(H); % ztrans returns numerator and denominator polynomials

h = impz(H, 10); % get the first 10 samples of the impulse response

time = 0:9; % Time index for the samples

stem(time, h); % Plot the impulse response

xlabel('Time (n)');

ylabel('Impulse Response h[n]');

title('Impulse Response of H(z)');


disp('Z-Transform (Numerator):');

disp(num_z);

disp('Z-Transform (Denominator):');

disp(den_z);

disp('Region of Convergence (ROC): |z| > 0.8');

31
The ROC is |z| > 0.8, meaning the z-transform is valid for magnitudes of z greater than 0.8.

Result:
Z-transform and its ROC from given transfer function is determined using MATLAB.

32

You might also like