0% found this document useful (0 votes)
29 views99 pages

EC593 Student Manual

Laboratory Report on Digital Signal Processing

Uploaded by

gifismile238
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)
29 views99 pages

EC593 Student Manual

Laboratory Report on Digital Signal Processing

Uploaded by

gifismile238
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
You are on page 1/ 99

Department of Electronics & Communication Engineering

B. P. Poddar Institute of Management & Technology

Laboratory Report on
Digital Signal Processing (EC593)

Name: _____________________________
University Roll No: _____________________
Year: ___________ Semester: _________
Section: _________ Group: ____________
Session: _____________________________

i
General Information

Course Digital Signal


Semester 5
Name ProcessingLaboratory

Year with
Course Code EC593 3rd Year ECE
stream

Course September______
2 Session
Credit to January_____

Class hours
Faculty 2 hours/week per batch
and total class
Instructor/s in odd semester
load

Technical Hamming Laboratory


Laboratory
Assistant/s Dept. of ECE

1. Familiarize students with generation of various discrete sequences using


Matlab and verify their arithmetic properties.
2. To provide an overview of different ways to compute linear and circular
convolution of sequences and signals. Also students will be taught how to
compare results of two convolutions.
Course 3. To provide understanding of Z-Transforms and DFT and verify different
Objectives properties.
4. Students will be taught to choose appropriate block convolution methods in
practical applications.
5. To provide an understanding of IIR and FIR filter design.
6. To familiarize with usage of TDM 3020C5416 Processor and Xilinx FPGA.

1. Investigate different arithmetic operations for standard discrete sequences.


2. Compare between linear and circular convolution.
3. Compute different transformations viz. Z-transform, DFT etc.
Course
Outcomes 4. Develop appropriate convolution methods for filtering of long data
sequences.
5. Design FIR and IIR filters for various applications within realistic constraints.
6. Develop programs for TDM 3020C5416 Processor and Xilinx FPGA.

ii
Course Outcomes to Program Outcomes Mapping

Course Name:

S.NO PO PO PO PO PO PO PO PO PO PO PO PO PSO1 PSO2


1 2 3 4 5 6 7 8 9 10 11 12
C317.1 3 3 3 3 3 2 3 1
C317.2 3 2 3 3 3 3 2 3 1
C317.3 3 3 3 3 3 2 3 1
C317.4 3 2 3 3 3 3 2 3 2
C317.5 3 2 2 3 3 3 3 2 3 2
C317.6 3 2 3 3 3 3 2 3 2
C317* 3 2 2 3 3 3 3 2 3 1.5

Note: Correlation levels are as defined:


1: Slight (Low) 2: Moderate (Medium) 3: Substantial (High).
If there is no correlation, put “-”

Safety Norms and precautions

1. Install any unlicensed software.


2. Insert pen drive without permission.
Do not 3. Handle any equipment without reading the instructions /Instruction manuals.
4. Use Mobile Phones during the lab session.
5. Come late in the laboratory. Late comers without proper reason and permission of HOD
will not be allowed to enter the lab.

1. Strictly observe the instructions given by the Teacher/ Lab Instructor.


2. It is mandatory to come to lab in formal dress (College uniform, ID card, and Shoes).
3. It is mandatory to come with observation book and lab record in which previous
experiment should be written in Record and the present lab’s experiment in Observation
Do book.
4. Observation book of the present lab experiment should get corrected on the same day
and Record should be corrected on the next scheduled lab session.
5. Prepare for the viva questions. At the end of the experiment, the lab faculty will ask the
viva Questions and marks are allotted accordingly.

iii
Course policies

1. Attendance
Attendance is compulsory. Please be respectful to your classmates by being on time. Cell
phones should be turned off and kept out of sight.

2. Calculator policy

You may need a calculator device.

3. Plagiarism

Collaboration on performing the experiments and taking measurements is strongly encouraged;


however, the lab report you hand in must be solely your own. Sharing written work beforehand is
considered as academic dishonesty.

4. Disability Support

If you have a disabling condition which may interfere with your ability to successfully complete
this module, please contact faculty in charge.

5. Make-up Experiment

Make-up for a missing experiment will not be offered, normally. The only exceptions to that are
illness or emergency (e.g., death in family, a traffic accident, etc.), in which case you may contact
your faculty in charge.

6. Additional Experiment

As per policy you have to perform at least oneadditional experiment from the list of beyond
syllabus experiments provided.

iv
Course Assessment Process
Internal Assessment (100 marks)
Continuous Assessment (80 marks)
Lab records [15 marks]
Experiment results, discussion and conclusion.
Lab performance [50 marks]
Performance on method of working, recording data, tabulating data, plotting graph, attendance
etc.
Viva at the end of each experiment [15 marks]
Internal Examination (before semester ends) (20 marks)
Assessment during end semester examination (60 marks)
Lab examination [40 marks]
Experiments are allotted to the students randomly on lottery basis during examination time which
they have to complete within stipulated time.
Viva [20 marks]
There is a 10-minute viva-voce during examination time.

Grading Scale
Grade Percent score
0 ≥ 90

E ≥ 80 and <90

A ≥ 70 and <80

B ≥ 60 and <70

C ≥ 50 and <60

D ≥ 40 and <50

F <40

1. John G. Proakis and Dimitris G. Manolakis, “Digital Signal Processing:


Principles, Algorithms and Applications”, Pearson, 4th edition.
Recommended 2. S. K. Mitra, “Digital Signal processing – A Computer Based Approach”,
TMH Publishing Co.
books
3. Texas Instruments, TMS320C5416/6713 documentation, available on the
CD-ROM of the DSP Starter Kit.
4. Xilinx FPGA user manuals and application notes.
v
List of Experiments
Expt. Name of Experiment Page Date of Grade Signature
No. Number Expt. awarded
Simulation Laboratory using Matlab

Generation of standard discrete


sequences, viz. Unit impulse, unit
step signal, unit ramp, exponential,
sinusoidal and verify different
1.
arithmetic operations like
amplitude scaling, time scaling,
folding, time shifting, addition and
multiplication

Linear convolution of two


sequences using graphical
2. methods and using commands and
verification of the properties of
convolution

Circular convolution of two


sequences using graphical
3. methods and using commands,
comparison between linear and
circular convolutions

Z-transform of various sequences


4. and verification of the properties of
Z-transform

Verification of the cyclic


5.
property of Twiddle Factors

Computation of DFTs and IDFTs


6. using matrix multiplication and
also using commands
Verifications of the different
algorithms associated with filtering
7. of long data sequences and
Overlap-add and Overlap-save
methods

Design a Butterworth digital IIR


lowpass filter using impulse
8. invariant transformation by taking
T=1 second, to satisfy the given
specifications

9. (a) Design a linear phase FIR

vi
lowpass filter using rectangular
window by taking 7 samples of
window sequence and with a cutoff
frequency, ωc = 0.2π rad/sample.

(b) Design a linear phase FIR


highpass filter using Hamming
window, with a cutoff frequency, ωc
= 0.8π rad/sample and N=7.

(c) Design a linear phase FIR


bandpass filter to pass frequencies
in the range 0.4π to 0.65π
rad/sample by taking 7 samples of
Blackman window sequence.

Hardware Laboratory using DSP Processor and Xilinx FPGA


Perform linear convolution using
10.
TMS320C5416/6713 Processor

Implement a half-adder and a


11.
full-adder using Xilinx FPGA

12. Additional experiment

vii
LAB SESSION 01

Title: Generation of sampled sinusoidal signal, various standard discrete


sequences, and verification of different arithmetic operations

Objective: Togenerate sampled unit impulse, unit step, unit ramp, exponential, sinusoidalsignals, and
to verifydifferent arithmetic propertieslike amplitude scaling, time scaling, folding, time shifting, addition
and multiplication

Theory:

The discrete signal is a function of a discrete independent variable. The independent variable is divided
into uniform intervals and each interval is represented by an integer. Generally, letter ‘𝑛’ is used to
denote the independent variable and the signal is written as𝑥(𝑛). When the independent variable is time
𝑡, the discrete signal is called discrete time signal. The digital signal is same as discrete signal except
that the magnitude of the signal is quantized.

Generation of standard discrete sequences:

A discrete time signal can be generated by uniformly sampling a continuous time signal and
using the amplitudes of the samples to form a sequence. The mathematical descriptions of some
standard discrete time signals are given below:

1; 𝑛=0
Unit impulse signal: 𝛿(𝑛) =
0, 𝑛≠0

1; 𝑛≥0
Unit step signal: 𝑢(𝑛) =
0, 𝑛<0

𝑛; 𝑛≥0
Ramp signal: 𝑢𝑟 (𝑛) =
0, 𝑛<0

Exponential signal: 𝑔(𝑛) = 𝑎𝑛 ; for all n

Sinusoidal signal: 𝑥(𝑛) = 𝐴 sin(𝜔0 𝑛 + 𝜃); −∞ < 𝑛 < +∞

Where, 𝜔0 is frequency in radians/sample; and 𝜃 is phase in radians.

Verification of arithmetic properties:

Amplitude scaling: Amplitude scaling of a discrete time signal by a constant A is accomplished by


multiplying the value of every signal by the constant A.

Time scaling: There are two ways of time scaling a discrete time signal. They are down sampling and
upsampling.

In a signal 𝑥(𝑛), if n is replaced by 𝐷𝑛, where 𝐷 is an integer, then it is called downsampling.


𝑛
In a signal 𝑥(𝑛), if n is replaced by 𝐼 , where 𝐼 is an integer, then it is called upsampling.

Folding: The folding of a discrete time signal 𝑥(𝑛) is performed by changing the sign of the time base
1
𝑛 in𝑥(𝑛). The folding operation produces a signal 𝑥(−𝑛) which is a mirror image of the signal𝑥(𝑛) with
respect to time origin 𝑛 = 0.

Time shifting: A signal 𝑥(𝑛) may be shifted in time by replacing the independent variable 𝑛 by 𝑛 – 𝑚,
where 𝑚 is an integer. If 𝑚 is a positive integer, the time shift results in a delay by m units of time. If m
is a negative integer, the time shift results in an advance of the signal by m units in time. The delay
results in shifting each sample 𝑥(𝑛) to the right. The advance results in shifting each sample 𝑥(𝑛) to
the left.

Addition: The addition of two discrete time signals is performed on a sample-by-sample basis. The sum
of two signals 𝑥 1(𝑛) and 𝑥 2(𝑛) is a signal 𝑦(𝑛), whose value at any instant is equal to the sum of the
samples of these two signals at that instant.

Multiplication: The multiplication of two discrete time signals is performed on a sample-by-sample


basis. The product of two signals 𝑥 1(𝑛) and 𝑥 2(𝑛) is a signal 𝑦(𝑛), whose value at any instant is equal
to the product of the samples of these two signals at that instant. The product is also called modulation.

Specifications:
For all signal generations, take the sample index from –20 to +20 with an increment of 1.
For the sinusoidal signal take the sampling frequency of 8 kHz.
For amplitude scaling, take the amplification factor as 2 and attenuation factor as 0.5.
For time scaling, take the scaling factor as 5.
For folding take the sample index from 0 to +20 with an increment of 1, but the plotting will be from –20
to +20.
For shifting take the shift as 5.

Problem statement:
1. Generate unit impulse, unit step, unit ramp, exponential, and sinusoidal signals.
2. Generate a 500 Hz sinusoidal signal. Also produce the amplified and attenuated versions of the
same signal.
3. Generate a 500 Hz sinusoidal signal. Also produce the downsampled and upsampled versions
of the same signal.
4. Generate a 500 Hz sinusoidal signal. Also produce the folded signal.
5. Generate a 500 Hz sinusoidal signal. Also produce the delayed and advanced versions of the
signal.
6. Generate a 500 Hz sinusoidal signal and a square signal of same frequency.Produce the added
signal.
7. Generate a 500 Hz sinusoidal signal and a square signal of same frequency. Produce the
multiplied signal.

Graphs to be displayed:
1. Using subplot command, divide the 1st figure into 6 parts. Plot discrete graphs for unit impulse,
unit step, unit ramp, exponential, and sinusoidal signal in the 1st, 2nd, 3rd, 4th, and 5th positions
respectively.
2. Using subplot command, divide the 2nd figure into 3 parts. Plot discrete graphs for original
sinusoidal signal, amplified signal and attenuated signal in the 1st, 2nd, and 3rd positions
respectively.
2
3. Using subplot command, divide the 3rd figure into 3 parts. Plot discrete graphs for original
sinusoidal signal, downsampled signal and upsampled signal in the 1st, 2nd, and 3rd positions
respectively.
4. Using subplot command, divide the 4th figure into 2 parts. Plot discrete graphs for original
sinusoidal signal, folded signal in the 1st, and 2nd positions respectively.
5. Using subplot command, divide the 5th figure into 3 parts. Plot discrete graphs for original
sinusoidal signal, delayed signal and advanced signal in the 1st, 2nd, and 3rd positions
respectively.
6. Using subplot command, divide the 6th figure into 3 parts. Plot discrete graphs for original
sinusoidal signal, original square signal and added signal in the 1st, 2nd, and 3rd positions
respectively.
7. Using subplot command, divide the 7th figure into 3 parts. Plot discrete graphs for original
sinusoidal signal, original square signal and added signal in the 1st, 2nd, and 3rd positions
respectively.

Program:

3
4
5
Paste Graphs here

6
Paste Graphs here

7
Paste Graphs here

8
Discussions:

9
Questionnaires:

10
Grade awarded

Lab record:

Lab Performance:

Viva:

Teacher’s signature with date _______________________

11
LAB SESSION 02
Title: Linear convolution of two sequences using graphical methods and using
commands and verification of the properties of convolution
Objective: To generate discrete signals and perform linear convolution of those and also to verify the
commutative, associate and distributive properties of linear convolution.

Theory:
Convolution is a mathematical operation on two functions 𝑥 1 and 𝑥 2, producing a third function 𝑦 that is
typically viewed as a modified version of one of the original functions, giving the area overlap between the
two functions as a function of the amount that one of the original functions is translated. The
discretelinear convolution of two discrete time sequences 𝑥 1(𝑛) and 𝑥 2(𝑛) is defined as:
∞ ∞

𝑦(𝑛) = ∑ 𝑥1 (𝑚)𝑥2 (𝑛 − 𝑚) 𝑜𝑟 𝑦(𝑛) = ∑ 𝑥2 (𝑚)𝑥1 (𝑛 − 𝑚) (1)


𝑚=−∞ 𝑚=−∞

Here, 𝑦(𝑛) is the sequence obtained by convolving 𝑥1 (𝑛) and 𝑥2 (𝑛), and 𝑚is a dummy variable.
The convolution relation of equation (1) can be symbolically expressed as:
𝑦(𝑛) = 𝑥1 (𝑛) ∗ 𝑥2 (𝑛) = 𝑥2 (𝑛) ∗ 𝑥1 (𝑛) (2)
In convolution of finite duration sequences, it is possible to predict the length of resultant sequence. If
the sequence 𝑥1 (𝑛)has 𝑁 1 samples and sequence 𝑥2 (𝑛)has 𝑁 2 samples then the convolution of
𝑥1 (𝑛)and 𝑥2 (𝑛) will produce a sequence𝑦(𝑛) consisting of N1 + N 2 − 1 samples.
In the convolution of finite duration sequences, it is possible to predict the start and end of the
resultant sequence. If 𝑥1 (𝑛) starts at 𝑛 = 𝑛1 and 𝑥2 (𝑛)starts at 𝑛 = 𝑛2 then, the initial value of 𝑛 for
𝑦(𝑛) is 𝑛 = 𝑛1+𝑛2. The value of 𝑥1 (𝑛)for 𝑛 < 𝑛1 and the value of 𝑥2 (𝑛) for 𝑛 < 𝑛2 are then assumed
to be zero. The final value of 𝑛 for 𝑦(𝑛)is n = (n1 + n2 ) + (N1 + N 2 − 1) − 1 = (n1 + n2 ) + (N1 + N 2 − 2) .

Here we consider two pulse signals and a ramp signal as:

𝑥1 (𝑛) = 1 for 1 ≤ 𝑛 ≤ 10

𝑥2 (𝑛) = 1 for 1 ≤ 𝑛 ≤ 10

𝑥3 (𝑛) = 𝑛 for 0 ≤ 𝑛 ≤ 10

Properties of Linear convolution:

The discrete linear convolution will satisfy the following properties:

Commutative property: 𝑥1 (𝑛) ∗ 𝑥2 (𝑛) = 𝑥2 (𝑛) ∗ 𝑥1 (𝑛)

Associative property: [𝑥1 (𝑛) ∗ 𝑥2 (𝑛)] ∗ 𝑥3 (𝑛) = 𝑥1 (𝑛) ∗ [𝑥2 (𝑛) ∗ 𝑥3 (𝑛)]

Distributive property: 𝑥1 (𝑛) ∗ [𝑥2 (𝑛) + 𝑥3 (𝑛)] = [𝑥1 (𝑛) ∗ 𝑥2 (𝑛)] + [𝑥1 (𝑛) ∗ 𝑥3 (𝑛)]

In Matlab the command conv performs the operation of convolution.

Specifications:
For all signal generations, take the sample index from 0 to 15 with an increment of 1.
12
Generate a step function with value 1 from 1 to 9, and another step function with value 1 from 4 to 12.

For verification of different properties generate another signal as ramp function from 0 to 10.

Problem Statement:
1. Generate a unit pulse 𝑥1 (𝑛)for 1 ≤ 𝑛 ≤ 10. Generate another unit pulse 𝑥2 (𝑛)for 4 ≤ 𝑛 ≤ 12.
Convolve the two functions (i) using signal processing toolbox in Matlab; and (ii) also using
graphical method. Compare the results.
2. Generate a ramp signal 𝑥3 (𝑛)for 0 ≤ 𝑛 ≤ 10. Take the unit pulse 𝑥1 (𝑛)already generated in
problem 1. Test the commutative property of linear convolution.
3. Take all the three signals generated, viz. 𝑥1 (𝑛), 𝑥2 (𝑛), and 𝑥3 (𝑛). Test the associative property
of linear convolution.
4. Take all the three signals generated, viz. 𝑥1 (𝑛), 𝑥2 (𝑛), and 𝑥3 (𝑛). Test the distributive property
of linear convolution.

Graphs to be displayed:

1. Using subplot command, divide the 1st figure into 4 parts. Plot discrete graphs for the first unit
step, and the second unit step in the 1st, 2nd positions respectively. Now plot the convolution using
conv command and without conv command in the 3rd and 4th positions respectively.
2. Using subplot command, divide the 2nd figure into 6 parts. Plot discrete graphs for the first unit
step, and the ramp signal in the 1st, 2nd positions respectively. Now plot the convolution between
1st and 2nd in the 3rd position and the convolution between 2nd and 1st in the 4th positions
respectively. Verification of the commutative property is to be plotted discretely in the 5th position.
3. Using subplot command, divide the 3rd figure into 6 parts. Plot discrete graphs for the first unit
step, the second unit step, and the ramp signal in the 1st, 2nd, and 3rd positions respectively. Now
plot [𝑥1 (𝑛) ∗ 𝑥2 (𝑛)] ∗ 𝑥3 (𝑛)in the 4th position, and plot 𝑥1 (𝑛) ∗ [𝑥2 (𝑛) ∗ 𝑥3 (𝑛)]in the 5th positions
respectively. Verification of the associative property is to be plotted discretely in the 6th position.
4. Using subplot command, divide the 3rd figure into 6 parts. Plot discrete graphs for the first unit
step, the second unit step, and the ramp signal in the 1st, 2nd, and 3rd positions respectively. Now
plot 𝑥1 (𝑛) ∗ [𝑥2 (𝑛) + 𝑥3 (𝑛)]in the 4th position, and plot [𝑥1 (𝑛) ∗ 𝑥2 (𝑛)] + [𝑥1 (𝑛) ∗ 𝑥3 (𝑛)]in the 5th
positions respectively. Verification of the associative property is to be plotted discretely in the 6 th
position.

Program:

13
14
15
16
Paste Graphs here

17
Paste Graphs here

18
Paste Graphs here

19
Discussions:

Questionnaires:

20
Grade awarded

Lab record:

Lab Performance:

Viva:

Teacher’s signature with date _______________________

21
LAB SESSION 03
Title:Circular convolution of two sequences using graphical methods and using
commands, comparison between linear and circular convolutions
Objective: To calculate the circular convolution of two sequences using graphical method and MATLAB
signal processing toolbox. Also to compare the results with that of linear convolution for the same
sequences.

Theory:
Convolution is a mathematical operation on two functions, producing a third function that is typically
viewed as a modified version of one of the original functions, giving the area overlap between the two
functions as a function of the amount that one of the original functions is translated. Convolution can be
either linear or circular. The circular convolution of two periodic discrete time sequences x1(n) and x2(n)
with periodicity of N samples is defined as
𝑁−1 𝑁−1

𝑦(𝑛) = ∑ 𝑥1 (𝑚)𝑥2 ((𝑛 − 𝑚))𝑁 or 𝑦(𝑛) = ∑ 𝑥2 (𝑚)𝑥1 ((𝑛 − 𝑚))𝑁


𝑚=0 𝑚=0

where, 𝑦(𝑛) is the sequence obtained by circular convolution,


𝑥1 ((𝑛 − 𝑚))𝑁 represents circular shift of x1(n)
𝑥2 ((𝑛 − 𝑚))𝑁 represents circular shift of x2(n)
m is a dummy variable

Circular convolution can be computed by graphical method, tabular method, matrix method etc. Here we
will use graphical method. In graphical method, the given sequences are converted to same size and
represented on circles. In case of periodic sequences, the samples of one period are represented on
circles. One of the sequences is folded and shifted circularly. Let 𝑥 1 (𝑛) and 𝑥 2 (𝑛) be the given
sequences. Let 𝑦(𝑛) be the sequence obtained by circular convolution of 𝑥 1 (𝑛) and 𝑥 2 (𝑛). The
following procedure can be used to get a sample of 𝑦(𝑛) at 𝑛 = 𝑞.

1. Change the index n in the sequences 𝑥 1(𝑛) and 𝑥 2(𝑛) to get 𝑥 1(𝑚) and 𝑥 2(𝑚) and then
represent the sequences on circles.
2. Fold one of the sequences. Let us fold 𝑥2(𝑚) to get 𝑥2(−𝑚).
3. Rotate (or shift) the sequence 𝑥 2(−𝑚), q times to get the sequence 𝑥 2((𝑞– 𝑚))𝑁. If q is positive
then rotate (or shift) the sequence in anticlockwise direction and if q is negative then rotate (or
shift) the sequence in clockwise direction.
4. The sample of 𝑦(𝑞) at 𝑛 = 𝑞 is given by,
𝑁−1 𝑁−1

𝑦(𝑞) = ∑ 𝑥1 (𝑚)𝑥2 ((𝑞 − 𝑚))𝑁 = ∑ 𝑥1 (𝑚)𝑥2,𝑞 (𝑚)


𝑚=0 𝑚=0
Determine the product sequence 𝑥1 (𝑚)𝑥2,𝑞 (𝑚) for one period.
5. The sum of all the samples of the product sequence gives the sample y(q).
The above procedure is repeated for all possible values of n to get the sequence y(n).

The linear convolution of two sequences of length N1 and N2 produces an output sequence of length
N1+N2–1. The discrete linear convolution of two discrete sequences x1(n) and x2(n) is defined as:
22
∞ ∞

𝑦(𝑛) = ∑ 𝑥1 (𝑚)𝑥2 (𝑛 − 𝑚) or 𝑦(𝑛) = ∑ 𝑥2 (𝑚)𝑥1 (𝑛 − 𝑚)


𝑚=−∞ 𝑚=−∞
Specification:
Use input command to accept input sequences from the user. The inputs have to be entered within
square brackets.

In the signal processing toolbox the commands cconv and conv perform the operation of circular
convolution and linear convolution of the sequences respectively.

Problem statement:
Take any two user-defined sequences.
1. Produce circular convolution of those sequences by graphical method and the same by using
command. Also produce the linear convolution of those sequences. Compare the results.
2. Also produce linear convolution of those sequences by circular convolution method.

Graphs to be displayed:

By dividing a figure window into3 parts using subplot command, show the discrete plot of circular
convolution result in the 1st position, the linear convolution result in the 2nd position, and the linear
convolution by circular convolution result in the 3rdposition.

Program:

23
24
Results:
Enter the 1st sequence:

Enter the 2nd sequence:

The result of circular convolution by graphical method is:

The result of circular convolution by using command is:

The result of linear convolution is:

25
Paste graphs here:

26
Discussions:

Questionnaires:

27
Grade awarded

Lab record:

Lab Performance:

Viva:

Teacher’s signature with date _______________________

28
LAB SESSION 04
Title: Z-transform of various sequences and verification of the properties of
Z-transform
Objective: To get used with the Z-transformation technique to analyze signals and verify its linearity,
differentiation, scaling, and time-reversal properties.

Theory:
Transformation techniques are an important tool in the analysis of signals and systems. The Z-transform
plays an important role in analysis and representation of discrete time signals and systems. It provides a
method for the analysis of discrete time signals and systems in the frequency domain which is generally
more efficient than its time domain analysis. The Z-transform of 𝑥(𝑛) will convert the time domain
signal𝑥(𝑛) to z-domain 𝑋(𝑧), where the signal becomes a function of complex variable z.
The complex variable z is defined as
𝑧 = 𝑢 + 𝑗𝑣 = 𝑟𝑒 𝑗𝜔
where, u = Real part of z; v = Imaginary part of z
𝑣
and 𝜔 = tan−1 𝑢 = Phase of Argument of z.
The u and v takes values from−∞ to +∞. A two dimensional complex plane with values of u on
horizontal axis and values of v on vertical axis is called z-plane.
Let, 𝑥(𝑛) = Discrete time signal
𝑋(𝑧) = Z-transform of x(n).
The Z-transform of a discrete time signal, x(n) is defined as:

𝑋(𝑧) = ∑ 𝑥(𝑛)𝑧 −𝑛 (1)


𝑛=−∞

Since the time index n is defined for both positive and negative values, the discrete time signal x(n) in
equation (1) is considered to be two-sided and the transform is called two-sided Z-transform. If the signal
x(n) is one-sided signal, [i.e., x(n) is defined only for positive value of n] then the Z-transform is called
one-sided Z-transform. It is defined as:

𝑋(𝑧) = ∑ 𝑥(𝑛)𝑧 −𝑛 (2)


𝑛=0

The computation of 𝑋(𝑧) involves summation of infinite terms which are functions of z. Hence, it is
possible that the infinite series may not converge to finite value for certain values of z. Therefore for
every𝑋(𝑧) there will be a set of values of z for which 𝑋(𝑧) can be computed. Such a set of values will lie
in a particular region of z-plane and this region is called region Of convergence (ROC) of 𝑋(𝑧).

Inverse Z-transform:
The inverse Z-transform of 𝑋(𝑧) is defined as:
1
𝑥(𝑛) = ∮ 𝑋(𝑧)𝑧 𝑛−1 𝑑𝑧 (3)
2𝜋𝑗
𝑐
Some properties of Z-transform:

The Z-transform will satisfy the following properties:

Linearity property: 𝑍{𝑎1 𝑥1 (𝑛) + 𝑎2 𝑥2 (𝑛)} = 𝑎1 𝑋1 (𝑧) + 𝑎2 𝑋2 (𝑧); here a1 and a2 are constants.

29
𝑑
Differentiation in z-domain: 𝑍{𝑛𝑥(𝑛)} = −𝑧 𝑑𝑧 𝑋(𝑧)

Scaling in z-domain: 𝑍{𝑎𝑛 𝑥(𝑛)} = 𝑋(𝑎−1 𝑧)

Time reversal: 𝑍{𝑥(−𝑛)} = 𝑋(𝑧 −1 )

Specifications:
Use symbolic maths toolbox.

Problem statement:
1. Generate five different signals: 𝑥1 = 𝑛, 𝑥2 = 𝑎𝑛 , 𝑥3 = 𝑛𝑎𝑛 , 𝑥4 = 𝑒 −𝑎𝑛𝑇 , 𝑥5 = sin(𝜔𝑛).Produce
the Z-transform for each of these five signals.
2. Generate two signals as: 𝑥1 = sin(𝜔𝑛), and 𝑥2 = 𝑒 −𝑛𝑇 . Test the linearity property.
3. Generate thesignal 𝑥 = sin(𝜔𝑛), and test the differentiation property.
4. Generate thesignal 𝑥 = cos(𝜔𝑛), and test the change of scale property.
5. Generate two signals: 𝑥1 = 𝑒 𝜔𝑛 , and 𝑥2 = 𝑒 −𝜔𝑛 . Test the time reversal property.
.

Program:

30
31
Results:
Table 1: Z-transform outputs

S.No. Input function Z Transform output

1. 𝑥1 = 𝑛

2. 𝑥2 = 𝑎𝑛

3. 𝑥3 = 𝑛𝑎𝑛

4. 𝑥4 = 𝑒 −𝑎𝑛𝑇

5. 𝑥5 = sin(𝜔𝑛)

32
Table 2: Verification of properties of Z-transform

Property
S. Input Property
to be LHS RHS
No. functions verified
verified

𝑥1 = sin(𝜔𝑛)
1. Linearity
𝑥2 = 𝑒 −𝑛𝑇

Differenti
2.
ation
𝑥1 = sin(𝜔𝑛)

3. Scaling 𝑥 = cos(𝜔𝑛)

𝑥1 = 𝑒 𝜔𝑛
Time-rev
4.
ersal
𝑥2 = 𝑒 −𝜔𝑛

Discussions:

33
Questionnaires:

Grade awarded

Lab record:

Lab Performance:

Viva:

Teacher’s signature with date _______________________

34
LAB SESSION 05
Title: Verification of the cyclic property of Twiddle Factors
Objective:To verify the cyclic property of twiddle factor
Theory:

The twiddle factor is denoted by WN and is given by: 𝑊𝑁 = 𝑒 −2𝑗𝜋⁄𝑁


The discrete time sequence 𝑥(𝑛) can be denoted as 𝑥𝑁 . Here, N stands for N point DFT. While in case
of N point DFT, the range of n is from 0 to N – 1. Now the sequence xN can be represented in the matrix
form as under:

𝑥(0)
𝑥(1)
𝑥𝑁 = 𝑥(2)

[𝑥(𝑁 − 1)]𝑁×1

This is anN×1 matrix and n varies from 0 to N – 1. The DFT of 𝑥(𝑛) is denoted by 𝑋(𝑘). 𝑥(𝑛)is denoted
as 𝑥𝑁 . Similarly, we can denote 𝑋(𝑘) by 𝑋𝑘 . In the matrix form, 𝑋𝑘 can be represented as:

𝑋(0)
𝑋(1)
𝑋𝑘 = 𝑋(2)

[𝑋(𝑁 − 1)]𝑁×1

This is also N×1 matrix and k varies from 0 to N – 1. DFT can be represented as:
𝑁−1

𝑋(𝑘) = ∑ 𝑥(𝑛)𝑊𝑁𝑘𝑛
𝑛=0

We can also represent 𝑊𝑁𝑘𝑛 in the matrix form as:

n=0 n =1 n=2  n = N −1
k =0 W 0
N W 0
N W 0
N  WN0
k =1 W 0
W 1
W 2
 WNN −1
WNkn = N N N

k =2 W 0
N W 2
N W 4
N  WN2( N −1)
    
N −1 2 ( N −1) ( N −1)2
k = N −1 W 0
N W N W N  WN N N

Let us now verify the cyclic property of WN. Let us consider 8-point DFT, i.e., N = 8.
2𝜋
We have, 𝑊𝑁 = 𝑒 −𝑗 𝑁
2𝜋
Therefore, 𝑊𝑁𝑘𝑛 = 𝑒 −𝑗 𝑁 ×𝑘𝑛
35
But, N = 8.
2𝜋 𝜋
Hence, 𝑊8𝑘𝑛 = 𝑒 −𝑗 8 ×𝑘𝑛 = 𝑒 −𝑗 4 ×𝑘𝑛

Different values of 𝑊8𝑘𝑛 is obtained by substituting different values of 𝑘𝑛. Since it is a 8-point DFT, it may
be observed that the value of 𝑊80 is same as 𝑊88 . Similarly, 𝑊81 is same as 𝑊89 and 𝑊82 is same as 𝑊810
and so on. This property of twiddle factor is called as periodicity property or cyclic property.

Problem statement:

Compute twiddle factor for N = 5 points.Examine the cyclic property of twiddle factor by showing that the
value of W50 is same as W55. Similarly, W51is same as W57and W53is same as W58 and so on.

Graph to be displayed:

Plot the twiddle factor in the figure window.

Program:

36
Results:

Display the values of 𝑊𝑁𝑘𝑛 :

37
Paste Graph here:

38
Discussions:

Questionnaires:

39
Grade awarded

Lab record:

Lab Performance:

Viva:

Teacher’s signature with date _______________________

40
LAB SESSION 06
Title: Computation of DFTs and IDFTs using matrix multiplication and also using
commands
Objective:To compute DFT and IDFT of a sequence using matrix multiplication and also using
command

Theory:
The discrete Fourier transform (DFT) has been developed to convert a continuous function of ω to a
discrete function of ω. Let,
x(n) = Discrete time signal of length L
X(k) = DFT of x(n)
Now, the N-point DFT of x(n), where N ≥ L, is defined as
𝑁−1
2𝜋𝑘𝑛
𝑋(𝑘) = ∑ 𝑥(𝑛)𝑒 −𝑗 𝑁 ; for 𝑘 = 0, 1, 2, ⋯ , 𝑁 − 1
𝑛=0
Since X(k) is a sequence consisting of N-complex numbers for k = 0,1,2,…,N–1, the DFT of x(n) can be
expressed as a sequence as:
X(k) = {X(0), X(1), X(2), … , X(N – 1)}
The inverse DFT of the sequence X(k) of length N is defined as:
𝑁−1
1 2𝜋𝑘𝑛
𝑥(𝑛) = ∑ 𝑋(𝑘)𝑒 𝑗 𝑁 ; for 𝑛 = 0, 1, 2, ⋯ , 𝑁 − 1
𝑁
𝑘=0

2𝜋𝑘𝑛
Now, we can define the term𝑒 −𝑗 𝑁 as twiddle factor WN. Hence using twiddle factor, we can write
equations of DFT and IDFT as:
𝑁−1

𝑋(𝑘) = ∑ 𝑥(𝑛)𝑊𝑁𝑘𝑛
𝑛=0
𝑁−1
1
𝑥(𝑛) = ∑ 𝑋(𝑘)𝑊𝑁−𝑘𝑛
𝑁
𝑘=0

Let us view the DFT and IDFT as linear transformations on sequences {x(n)} and {X(k)}, respectively. Let
us define an N-point an N-point vector xN of frequency samples, and an N×N matrix WN as
𝑥(0) 𝑋(0)
𝑥(1) 𝑋(1)
𝑥𝑁 = [ ]; 𝑋𝑁 = [ ]
⋮ ⋮
𝑥(𝑁 − 1) 𝑋(𝑁 − 1)

1 1 1  1 
1 W W N2  W N −1 
 N N 
2 ( N −1)
W N = 1 W N2 W N4  W N

 
    
( )
1 W N
1 N −1
W N ( N −1)
2
 W N( N −1)( N −1) 
With these definitions, the N point DFT can be expressed in matrix form as:
𝑋𝑁 = 𝑊𝑁 𝑥𝑁
41
Similarly, the IDFT can be expressed in matrix form as:
1
𝑥𝑁 = 𝑊𝑁∗ 𝑋𝑁
𝑁

Where 𝑊𝑁∗ denotes the complex conjugate of the matrix WN.


In Matlab in the signal processing toolbox the commands fft and ifft perform the DFT and IDFT of the
sequences.

Problem statement:
Generate a sequence as x = [31 12 20 -40 -21 69]. Calculate twiddle factor for 6 points.Produce the
Discrete Fourier Transform of the sequence using fft command and also using matrix method.
Similarly produce the Inverse Discrete Fourier Transform of the dft sequence obtained using ifft
command and show thatthe result is identical with the DFT computed by using matrix method.

Program:

42
Results:

Table 1:

Sequence taken: DFT using fft command DFT using matrix method

Table 2:

Sequence taken: IDFT using ifft command IDFT using matrix method

43
Discussions:

Questionnaires:

44
Grade awarded

Lab record:

Lab Performance:

Viva:

Teacher’s signature with date _______________________

45
LAB SESSION 07
Title: Verification of different algorithms associated with filtering of long data
sequences: Overlap-add and Overlap-save methods
Objective:To compute block convolution using overlap-add and overlap-save methods
Theory:
In real time applications, the input data sequence is very long. So it is difficult to compute the linear
convolution as (i) the entire sequence should be available before convolution can be carried out. This
makes long delay in getting the output, and (ii) large amounts of memory are required to store the
sequences. To solve the above problems, long input data sequence is broken into small length
sequences. The computation of each block is done separately. Then all processed blocks are fitted one
after the other to get the final output. There are two methods to sectioned convolutions. They are overlap
add and overlap save method.

Overlap Add Method


In the overlap add method, the longer sequence is divided into smaller sequences. Then linear
convolution of each section of longer sequence and smaller sequence is performed. The overall output
sequence is obtained by combining the output of the sectioned convolution.
Let, N1 = Length of longer sequence
N2 = Length of smaller sequence
Let the longer sequence be divided into sections of size N3 samples.
The linear convolution of each section with smaller sequence will produce an output sequence of size
𝑁3+𝑁2– 𝑁1 samples. In this method the last 𝑁2– 1 samples of each output sequence overlaps with the
first 𝑁2– 1 samples of the next section. While combining the output sequences of the various sectioned
convolutions, the corresponding samples of overlapped regions are added and the samples of
non-overlapped regions are retained as such.

Overlap Save Method


In the overlap save method, the results of linear convolution of the various sections are obtained using
circular convolution. In this method, the longer sequence is divided into smaller sequences. Each
section of the longer sequence and the smaller sequence are converted to the size of the output
sequence of sectioned convolution. The circular convolution of each section of the longer sequence and
smaller sequence is performed. The overall output sequence is obtained by combining the outputs of the
sectioned convolution.

In this method,the results of linear convolution are obtained by circular convolution. Hence each
section of longer sequence and smaller sequence are converted to the size of the output sequence of
size 𝑁 3 +𝑁 2 – 𝑁 1 samples. The smaller sequence is converted to size of 𝑁 3 +𝑁 2 – 𝑁 1samples, by
appending with zeros.

Specification:
Take four different cases:

1. The first sequence as an even sequence and the second sequence as an odd sequence.
2. Both the first and the second sequence as even sequence.
3. The first sequence as an odd sequence and the second sequence as an even sequence.
46
4. Both the first and the second sequence as odd sequence.

Problem statement:
Take any two sequences. Produce the block convolution using overlap add and overlap save method.
Compare the results for the same inputs.

Graphs to be displayed:

By dividing a figure window in 2 parts using subplot command, show the discrete plot of overlap add
convolution result in the 1st position, and the overlap save convolution result in the 2nd position.

Program:

47
48
Results:
For the first sequence as an even sequence and the second sequence as an odd sequence:

Computing Block Convolution using Overlap Add Method

Enter the sequence x(n):

Enter the sequence h(n):

The output sequence y(n):

Computing Block Convolution using Overlap Save Method

Enter the sequence x(n):

Enter the sequence h(n):

The output sequence y(n):

For both the first and the second sequence as even sequence:

Computing Block Convolution using Overlap Add Method

Enter the sequence x(n):

Enter the sequence h(n):

The output sequence y(n):

Computing Block Convolution using Overlap Save Method

Enter the sequence x(n):

Enter the sequence h(n):

The output sequence y(n):

49
For the first sequence as an odd sequence and the second sequence as an even sequence:

Computing Block Convolution using Overlap Add Method

Enter the sequence x(n):

Enter the sequence h(n):

The output sequence y(n):

Computing Block Convolution using Overlap Save Method

Enter the sequence x(n):

Enter the sequence h(n):

The output sequence y(n):

For both the first and the second sequence as odd sequence:

Computing Block Convolution using Overlap Add Method

Enter the sequence x(n):

Enter the sequence h(n):

The output sequence y(n):

Computing Block Convolution using Overlap Save Method

Enter the sequence x(n):

Enter the sequence h(n):

The output sequence y(n):

50
Paste Graphs here:

51
Discussions:

Questionnaires:

52
Grade awarded

Lab record:

Lab Performance:

Viva:

Teacher’s signature with date _______________________

53
LAB SESSION 08
Title:Butterworth filter design with different set of parameters
Objective:To design a Butterworth 2nd order lowpass filter using impulse invariant transformationby
taking T=1 second, to satisfy the following specifications:
Passband ripple ≤ 3.01 dB
Stopband attenuation ≥ 13.97 dB
Passband edge frequency = 0.3π rad/sample
Stopband edge frequency = 0.75π rad/sample

Theory:

The specification of a digital filter will be desired frequency response,𝐻𝑑 (𝑒 𝑗𝜔 ). The desired impulse
response,ℎ𝑑 (𝑛) of the digital filter can be obtained by taking inverse Fourier transform of 𝐻𝑑 (𝑒 𝑗𝜔 ). Now,
the ℎ𝑑 (𝑛) will be an infinite duration discrete time signal defined for all values of n in the range −∞ 𝑡𝑜 +
∞. The filters designed by considering all the infinite samples of impulse response are called IIR (Infinite
Impulse Response) filters.
In digital domain, the processing of infinite impulse response is practically not possible. Hence direct
design of IIR filter is not possible. Therefore IIR filters are designed via analog filters. The objective of
impulse invariant transformation is to develop an IIR filter transfer function whose impulse response is the
sampled version of the impulse response of the analog filter. The main idea behind this technique is to
preserve the frequency response characteristics of the analog filter. The specification of the IIR filter can
be expressed in any of the following three different ways:
• Gain at passband and stopband edge frequency
• Attenuation at passband and stopband edge frequency
• Ripple at passband and stopband edge frequency
As already mentioned the digital IIR filters designed from the analog filters. Many times, it is necessary
to approximate the characteristics of analog filter. There are three different types of approximation
techniques:

i. Butterworth filter approximation


ii. Chebyshev filter approximation
iii. Elliptic filter approximation
The main characteristic of Butterworth approximation is that the passband is maximally flat. The
magnitude squared response of lowpass Butterworth filter is given by:

1
|𝐻(𝑗Ω)|2 =
Ω 2𝑁
1+( )
Ω𝑐

This equation may also be expressed as

1
|𝐻(𝑗Ω)|2 = 2𝑁
Ω
1 + 𝜀 2 (Ω )
𝑝

Here, Ωc = Cut-off frequency (-3 dB frequency)


𝛺p = Passband edge frequency
𝑁 = Order of the filter
54
𝜀 = Parameter related to ripples in passband

Design procedure for lowpass digital Butterworth IIR filter

Let, 𝜔p = Passband edge digital digital frequency in rad/sample


𝜔s = Stopband edge digital digital frequency in rad/sample
1
𝑇 = 𝐹 = Sampling time in sec.
𝑠
where, 𝐹 s = sampling frequency in Hz.
𝐴p= Gain at a passband frequency ωp.
𝐴s = Gain at a passband frequency ωs.

1. Band edge frequencies are calculated using the following equations:


Let, Ω𝑝 = Passband edge analog frequency corresponding to ωp

Ω𝑠 = Passband edge analog frequency corresponding to ωs


𝜔𝑝
Ω𝑝 = 𝑇

𝜔𝑠
Ω𝑠 = 𝑇

2. Order of filter is calculated using the following equations:


(1⁄𝐴2 )−1
𝑠
1 log [(1⁄𝐴2 )−1]
𝑝
𝑁1 =
2 Ω
log (Ω 𝑠 )
𝑝
Choose N such that, 𝑁 ≥ 𝑁1. Usually N is chosen as nearest integer just greater than 𝑁1.

3. The analog cutoff frequency is calculated as:


Ω𝑠
Ω𝑐 = 1
[(1⁄𝐴2𝑠 ) − 1]2𝑁
4. Determine the transfer function of digital filter, 𝐻(𝑧).

Mathematical Calculations:

Specifications of digital IIR lowpass filter

Passband edge digital frequency, 𝜔p = 0.3π rad/sample


Stopband edge digital frequency, 𝜔s = 0.75π rad/sample
Gain in normal value at passband edge,𝐴𝑝 = 10(−𝛿𝑝1,𝑑𝐵 ⁄20) = 10(−3.01⁄20) = 0.707
Gain in normal value at stopband edge, 𝐴𝑠 = 10(−𝛼𝑠,𝑑𝐵 ⁄20) = 10(−13.97⁄20) = 0.2
Sampling time, T = 1 second

Specifications of analog IIR lowpass filter

55
Gain in normal value at passband edge, 𝐴𝑝 = 0.707
Gain in normal value at stopband edge, 𝐴𝑠 = 0.2
For impulse invariant transformation,
𝜔𝑝 0.3𝜋
Passband edge analog frequency, Ω𝑝 = 𝑇
= 1 = 0.9425 𝑟𝑎𝑑/𝑠𝑒𝑐𝑜𝑛𝑑
𝜔𝑠 0.75𝜋
Stopband edge analog frequency, Ω𝑠 = 𝑇
= 1 = 2.3562 𝑟𝑎𝑑/𝑠𝑒𝑐𝑜𝑛𝑑

Order of the filter

(1⁄𝐴2 )−1
𝑠
1 log [(1⁄𝐴2 )−1]
𝑝
𝑁1 = = 1.7339
2 Ω
log (Ω 𝑠 )
𝑝

Choose order N, such that N≥N1 and N is an integer.


Let order, N =2

Problem statement:

Design a Butterworth 2nd order lowpass filter using impulse invariant transformation by taking T=1
second, to satisfy the given specifications. Display on the command window the following:
i. Passband attenuation in dB
ii. Stopband attenuation in dB
iii. Passband edge analog frequency in rad/sec
iv. Stopband edge analog frequency in rad/sec
v. The order of filter
vi. The cut off frequency of filter in rad/sec
vii. Normalised Transfer function.
viii. Unnormalised Transfer function.
ix. Digital Transfer function.
x. Sampling time.
xi. Frequency response.
xii. Magnitude response.

Graphs to be displayed:

By dividing a figure window in 2 parts using subplot command, plot the magnitude and phase
response of Butterworth 2nd order Lowpass Filter in the 1st and 2nd positions respectively

.Program:

56
57
58
Results:

Passband attenuation in dB is:

Stopband attenuation in dB is:

Passband edge analog frequency in rad/sec is:

Stopband edge analog frequency in rad/sec is:

The order of filter is:

The cut off frequency of filter is:

Normalised Transfer function:

Unnormalised Transfer function:

Digital Transfer function:

Sampling time:

59
Paste Graphs here:

60
Discussions:

Questionnaires:

61
Grade awarded

Lab record:

Lab Performance:

Viva:

Teacher’s signature with date _______________________

62
LAB SESSION 09
Title:FIR filter design using rectangular, Hamming and Blackman windows
Objective:To design:
(a) a linear phase FIR lowpass filter using rectangular window by taking 7 samples of window sequence
and with a cutoff frequency, ωc = 0.2π rad/sample.
(b) a linear phase FIR highpass filter using Hamming window, with a cutoff frequency, ωc = 0.8π
rad/sample and N=7.
(c) a linear phase FIR bandpass filter to pass frequencies in the range 0.4π to 0.65π rad/sample by
taking 7 samples of Blackman window sequence.

Theory:
The filters are frequency selective devices. In general, the specification of a digital filter will be desired
frequency response,𝐻𝑑 (𝑒 𝑗𝜔 ). The desired impulse response,ℎ𝑑 (𝑛) of the digital filter can be obtained by
taking inverse Fourier transform of 𝐻𝑑 (𝑒 𝑗𝜔 ). Now, the ℎ𝑑 (𝑛) will be an infinite duration discrete time
signal defined for values of n in the range −∞ to + ∞.
The transfer function, H(z) of the digital filter is obtained by taking Z-transform of impulse response.
Since ℎ𝑑 (𝑛) is an infinite duration signal, the transfer function obtained from ℎ𝑑 (𝑛)will have infinite
terms, which is not possible to realize or implement in a digital system. Therefore, finite number of
samples of ℎd(𝑛) are selected to form the impulse response, ℎ(𝑛) of the filter. The transfer function,
𝐻(𝑍) is obtained by taking Z-transform of finite sample impulse response, ℎ(𝑛). The filters designed by
using finite samples of impulse response are called FIR (Finite Impulse Response) filters.

Design of linear phase FIR filters using Windows

As already mentioned, we begin with the desired frequency response Hd(ejω) and determine
corresponding ℎ𝑑 (𝑛). The infinite unit sample response ℎ𝑑 (𝑛)must be truncated at some point say at n
= N – 1 to yield an FIR filter of length N. the truncation is obtained by multiplying ℎ𝑑 (𝑛) by a window
sequence w(n). The resultant sequence will be of length N and can be denoted as ℎ(𝑛). there have
been many windows proposed, viz. the Rectangular window, Hamming window, Hanning window,
Blackman window, Kaiser window, etc. Here we will deal with the Rectangular wR(n), Hamming,
𝑤H(𝑛) and Blackman windows 𝑤B(𝑛). It is observed that in the passband a series of overshoots and
undershoots occur. This result is known as the Gibbs phenomenon.

Rectangular Window

The N-point rectangular window, 𝑤R(𝑛) is defined as


𝑁−1 𝑁−1
1; for 𝑛 = − to +
𝑤R(𝑛) = 2 2 (9.1)
0; otherwise

Alternatively,

1; for 𝑛 = 0 to 𝑁 − 1
𝑤R(𝑛) = (9.2)
0; otherwise

The rectangular window sequence defined by equation (9.1) can be used only for odd values of N, but
63
the window sequence defined by equation (9.2) can be used for both odd and even values of N.

Hamming Window

The N-point Hamming window, 𝑤H(𝑛) is defined as


2𝜋𝑛 𝑁−1 𝑁−1
0.54 + 0.46 cos 𝑁−1 ; for 𝑛 = − to +
𝑤H(𝑛) = 2 2 (9.3)
0; otherwise

Alternatively,
2𝜋𝑛
0.54 − 0.46 cos ; for 𝑛 = 0 to 𝑁 − 1
𝑤H(𝑛) = 𝑁−1 (9.4)
0; otherwise

The Hamming window sequence defined by equation (9.3) can be used only for odd values of N, but the
window sequence defined by equation (9.4) can be used for both odd and even values of N.

Blackman Window

The N-point Blackman window, wB(n) is defined as


2𝜋𝑛 4𝜋𝑛 𝑁−1 𝑁−1
0.42 + 0.5 cos 𝑁−1 + 0.08 cos 𝑁−1 ; for 𝑛 = − to +
𝑤B(𝑛) = 2 2 (9.5)
0; otherwise

Alternatively,
2𝜋𝑛 4𝜋𝑛
0.42 − 0.5 cos + 0.08 cos ; for 𝑛 = 0 to 𝑁 − 1
𝑤B(𝑛) = 𝑁−1 𝑁−1 (9.6)
0; otherwise

The Blackman window sequence defined by equation (9.5) can be used only for odd values of N, but the
window sequence defined by equation (9.6) can be used for both odd and even values of N.

Mathematical Calculations:

For FIR lowpass filter design with Rectangular Window

𝑒 −𝑗𝜔𝛼 ; −𝜔𝑐 ≤ 𝜔 ≤ −𝜔𝑐


Let 𝐻𝑑 (𝑒 𝑗𝜔 ) =
0; otherwise

ℎd(𝑛) is obtained by taking inverse Fourier transform of 𝐻𝑑 (𝑒 𝑗𝜔 ).

sin 𝜔𝑐 (𝑛−𝛼)
We find,ℎd(𝑛) = 𝜋(𝑛−𝛼)
; for all n, except n = α.

𝜔𝑐
When 𝑛 = 𝛼; ℎd(𝑛) =
𝜋

The impulse response ℎ(𝑛) of FIR is obtained by multiplying ℎd(𝑛) by rectangular window sequence.

64
For FIR highpass filter design with Hamming Window

𝑒 −𝑗𝜔𝛼 ; −𝜋 ≤ 𝜔 ≤ −𝜔𝑐 𝑎𝑛𝑑 + 𝜔𝑐 ≤ 𝜔 ≤ +𝜋


Let 𝐻𝑑 (𝑒 𝑗𝜔 ) =
0; otherwise

ℎd(𝑛) is obtained by taking inverse Fourier transform of 𝐻d(𝑒jω).


sin 𝜋(𝑛−𝛼)−sin 𝜔𝑐 (𝑛−𝛼)
We find,ℎd(𝑛) = 𝜋(𝑛−𝛼)
; for all 𝑛, except 𝑛 = 𝛼.

𝜔𝑐
When 𝑛 = 𝛼; ℎd(𝑛) = 1 − 𝜋

The impulse response ℎ(𝑛) of FIR is obtained by multiplying ℎd(𝑛) by Hamming window sequence.

For FIR bandpass filter design with Blackman Window

𝑒 −𝑗𝜔𝛼 ; −𝜔𝑐2 ≤ 𝜔 ≤ −𝜔𝑐1 𝑎𝑛𝑑 + 𝜔𝑐1 ≤ 𝜔 ≤ +𝜔𝑐2


Let 𝐻𝑑 (𝑒 𝑗𝜔 ) =
0; otherwise

ℎd(𝑛) is obtained by taking inverse Fourier transform of 𝐻d(𝑒jω).


sin 𝜔𝑐2 (𝑛−𝛼)−sin 𝜔𝑐1 (𝑛−𝛼)
We find, ℎd(𝑛) = 𝜋(𝑛−𝛼)
; for all 𝑛, except𝑛 = 𝛼.

𝜔𝑐2 −𝜔𝑐1
When 𝑛 = 𝛼; ℎd(𝑛) = 𝜋

The impulse response ℎ(𝑛) of FIR is obtained by multiplying ℎd(𝑛) by Blackman window sequence.

Problem statement:
1. Design a linear phase FIR lowpass filter using rectangular window by taking 7 samples of
window sequence and with a cutoff frequency, ωc = 0.2π rad/sample.
2. Design a linear phase FIR highpass filter using Hamming window, with a cutoff frequency, ωc =
0.8π rad/sample and N=7.
3. Design a linear phase FIR bandpass filter to pass frequencies in the range 0.4π to 0.65π
rad/sample by taking 7 samples of Blackman window sequence.

Graphs to be displayed:

Dividing the 1st figure into 2 parts using subplot command, plot the magnitude and phase response of
LPF using rectangular window technique, in the 1st and 2nd positions respectively.

Dividing the 2nd figure into 2 parts using subplot command, plot the magnitude and phase response of
HPF using Hamming window technique, in the 1st and 2nd positions respectively.

Dividing the 3rd figure into 2 parts using subplot command, plot the magnitude and phase response of
BPF using Blackman window technique, in the 1st and 2nd positions respectively.

Program:

65
66
67
68
69
Paste Graphs here:

70
Paste Graphs here:

71
Discussions:

Questionnaires:

72
Grade awarded

Lab record:

Lab Performance:

Viva:

Teacher’s signature with date _______________________

73
LAB SESSION 10
Title: Perform linear convolution using TMS320C5416/6713 Processor
Objective:To study the linear convolution using Assembly Language of TDM 3020C5416DSK
Processor

Theory:
The linear convolution operation can be represented by a Mathematical Expression as
𝑦[𝑛] = ∑ 𝑥[𝑘] ∗ ℎ[𝑛 − 𝑘] ; 𝑛 = 0 to 𝑁 − 1, 𝑘 = 0 to 𝑁 − 1

Where 𝒙= input signal samples, 𝒉=impulse response coefficient,𝒚=convolved output, and N = No of


input samples,

Here 𝒚[𝒏], 𝒙[𝒌], 𝒉[𝒏 − 𝒌] are 1-D matrices

CONV: Convolution and polynomial multiplication.

C = CONV(A,B) convolves vectors A and B.

The resulting vector is of length: 𝒍𝒆𝒏𝒈𝒕𝒉 (𝑨) + 𝒍𝒆𝒏𝒈𝒕𝒉 (𝑩) − 𝟏.

If A and B are vectors of polynomial coefficients, convolving them is equivalent to multiplying the two
polynomials.

Specifications:

Take two sequences as:

x={1,2,3,4,5,6}

and h={1,2,3,4}

Save the program as conv.c

Graph to be displayed:

Display the graph of linear convolution.

Problem statement:
Produce the linear convolution for the two sequences using TMS320C5416/6713 Processor.

74
Program:

75
Procedure:

1. Open Code Composer Studio; make sure the DSP kit is turned on.
2. Use the Debug → Connect menu option to open a debug connection to the DSK board
3. Start a new project using ‘Project-new ‘pull down menu, save it in a separate directory
(C:\CCStudio_v3.1\myprojects) with name lconv.pjt.
4. Add the source files conv.c to the project using ‘Project→adds files to project’ pull down menu.
5. Add the linker command file hello.cmd.
(Path: C:\CCStudio_v3.1\tutorial\sim54xx\hello1\hello.cmd)
6. Add the run time support library file rts_EXT.lib
(Path: C:\CCStudio_v3.1\c5400\cgtools\lib\rts_EXT.lib)
7. Compile the program using the ‘Project-compile’ pull down menu or by clicking the shortcut icon
on the left side of program window
8. Build the program using the ‘Project-Build’ pull down menu or by clicking the shortcut icon on the
left side of program window.
9. Load the program (lconv.out) in program memory of DSP chip using the ‘File-load program’ pull
down menu.
10. To View output graphically
Select view → graph → time and frequency.

Results:

The 1st sequence is:

The 2nd sequence is:

The output is:

76
Paste Graph here:

77
Discussions:

Questionnaires:

78
Grade awarded

Lab record:

Lab Performance:

Viva:

Teacher’s signature with date _______________________

79
LAB SESSION 11
Title: Implement a half-adder and a full-adder using Xilinx FPGA
Objective:To implement Half Adder & Full Adder using XILINX project navigator & MODELSIM
simulator.Verification of Truth Table & output waveforms.

Theory:
Half adder as we know is the circuit to perform addition between two binary bits, whereas full adder is
that which performs addition between three binary bits. Here we will implement these two circuits using
VHDL (VHSIC Hardware Description Language) program. Then we will download it onto Xilinx FPGA.
Then we will verify the truth tables for the two circuits.

Circuit Diagram of Half Adder:


a
b Sum

Carry

Circuit Diagram of Full Adder:

a
b Sum
c

Carry

80
Waveforms:

Half Adder:

Full Adder:

Problem statement:
Develop a half adder and a full adder using XILINX project navigator & MODELSIM simulator. Verify the
Truth Tables and output waveforms.

81
Program:

82
83
Discussions:

Questionnaires:

84
Grade awarded

Lab record:

Lab Performance:

Viva:

Teacher’s signature with date _______________________

85
PART - II
Additional Experiment:
Title:

Objective:

Theory:

86
Program:

87
88
Graphs:

89
Discussions:

Grade awarded

Lab record:

Lab Performance:

Viva:

Teacher’s signature with date _______________________

90
91
92

You might also like