EC593 Student Manual
EC593 Student Manual
Laboratory Report on
Digital Signal Processing (EC593)
Name: _____________________________
University Roll No: _____________________
Year: ___________ Semester: _________
Section: _________ Group: ____________
Session: _____________________________
i
General Information
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
ii
Course Outcomes to Program Outcomes Mapping
Course Name:
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
3. Plagiarism
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
vi
lowpass filter using rectangular
window by taking 7 samples of
window sequence and with a cutoff
frequency, ωc = 0.2π rad/sample.
vii
LAB SESSION 01
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.
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
Time scaling: There are two ways of time scaling a discrete time signal. They are down sampling and
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.
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:
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:
∞ ∞
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) .
𝑥1 (𝑛) = 1 for 1 ≤ 𝑛 ≤ 10
𝑥2 (𝑛) = 1 for 1 ≤ 𝑛 ≤ 10
𝑥3 (𝑛) = 𝑛 for 0 ≤ 𝑛 ≤ 10
Associative property: [𝑥1 (𝑛) ∗ 𝑥2 (𝑛)] ∗ 𝑥3 (𝑛) = 𝑥1 (𝑛) ∗ [𝑥2 (𝑛) ∗ 𝑥3 (𝑛)]
Distributive property: 𝑥1 (𝑛) ∗ [𝑥2 (𝑛) + 𝑥3 (𝑛)] = [𝑥1 (𝑛) ∗ 𝑥2 (𝑛)] + [𝑥1 (𝑛) ∗ 𝑥3 (𝑛)]
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:
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
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
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
∞ ∞
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:
25
Paste graphs here:
26
Discussions:
Questionnaires:
27
Grade awarded
Lab record:
Lab Performance:
Viva:
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:
∞
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:
∞
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:
Linearity property: 𝑍{𝑎1 𝑥1 (𝑛) + 𝑎2 𝑥2 (𝑛)} = 𝑎1 𝑋1 (𝑧) + 𝑎2 𝑋2 (𝑧); here a1 and a2 are constants.
29
𝑑
Differentiation in z-domain: 𝑍{𝑛𝑥(𝑛)} = −𝑧 𝑑𝑧 𝑋(𝑧)
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
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:
34
LAB SESSION 05
Title: Verification of the cyclic property of Twiddle Factors
Objective:To verify the cyclic property of twiddle factor
Theory:
𝑥(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
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:
Program:
36
Results:
37
Paste Graph here:
38
Discussions:
Questionnaires:
39
Grade awarded
Lab record:
Lab Performance:
Viva:
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
𝑥𝑁 = 𝑊𝑁∗ 𝑋𝑁
𝑁
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:
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.
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:
For both the first and the second sequence as even sequence:
49
For the first sequence as an odd sequence and the second sequence as an even sequence:
For both the first and the second sequence as odd sequence:
50
Paste Graphs here:
51
Discussions:
Questionnaires:
52
Grade awarded
Lab record:
Lab Performance:
Viva:
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:
1
|𝐻(𝑗Ω)|2 =
Ω 2𝑁
1+( )
Ω𝑐
1
|𝐻(𝑗Ω)|2 = 2𝑁
Ω
1 + 𝜀 2 (Ω )
𝑝
𝜔𝑠
Ω𝑠 = 𝑇
Mathematical Calculations:
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 𝑟𝑎𝑑/𝑠𝑒𝑐𝑜𝑛𝑑
(1⁄𝐴2 )−1
𝑠
1 log [(1⁄𝐴2 )−1]
𝑝
𝑁1 = = 1.7339
2 Ω
log (Ω 𝑠 )
𝑝
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:
Sampling time:
59
Paste Graphs here:
60
Discussions:
Questionnaires:
61
Grade awarded
Lab record:
Lab Performance:
Viva:
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.
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
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
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
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:
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
𝜔𝑐
When 𝑛 = 𝛼; ℎd(𝑛) = 1 − 𝜋
The impulse response ℎ(𝑛) of FIR is obtained by multiplying ℎd(𝑛) by Hamming window sequence.
𝜔𝑐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:
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
If A and B are vectors of polynomial coefficients, convolving them is equivalent to multiplying the two
polynomials.
Specifications:
x={1,2,3,4,5,6}
and h={1,2,3,4}
Graph to be displayed:
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:
76
Paste Graph here:
77
Discussions:
Questionnaires:
78
Grade awarded
Lab record:
Lab Performance:
Viva:
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.
Carry
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:
85
PART - II
Additional Experiment:
Title:
Objective:
Theory:
86
Program:
87
88
Graphs:
89
Discussions:
Grade awarded
Lab record:
Lab Performance:
Viva:
90
91
92