Dsp@unit 1
Dsp@unit 1
Department of
UNIT-I
Introduction:
Let’s start with the individual meaning of the words defining Digital Signal Processing in
its entirety.
o Digital: In digital communication, we use discrete signals to represent data using binary
numbers.
o Signal: A signal is anything that carries some information. It’s a physical quantity that
conveys data and varies with time, space, or any other independent variable. It can be in
the time/frequency domain. It can be one-dimensional or two-dimensional. Here are all
the major types of signals.
o Processing: The performing of operations on any data in accordance with some
protocol or instruction is known as processing.
o System: A system is a physical entity that is responsible for the processing. It has the
necessary hardware to perform the required arithmetic or logical operations on a signal.
Here are all the major types of systems.
Putting all these together, we can get a definition for DSP.
The first step is to get an electrical signal. The transducer (in our case, a microphone)
converts sound into an electrical signal. You can use any transducer depending upon
the case.
Once you have an analog electrical signal, we pass it through an operational amplifier
(Op-Amp) to condition the analog signal. Basically, we amplify the signal. Or limit it to
protect the next stages.
The anti-aliasing filter is an essential step in the conversion of analog to a digital signal.
It is a low-pass filter. Meaning, it allows frequencies up to a certain threshold to pass. It
attenuates all frequencies above this threshold. These unwanted frequencies make it
difficult to sample an analog signal.
The next stage is a simple analog-to-digital converter (ADC). This unit takes in analog
signals and outputs a stream of binary digits.
The heart of the system is the digital signal processor. These days we use CMOS chips
(even ULSI) to make digital signal processors. In fact, modern processors, like the
Cortex M4 have DSP units built inside the SoC. These processor units have high-speed,
high data throughputs, and dedicated instruction sets.
The next stages are sort of the opposite of the stages preceding the digital signal
processor.
The digital-to-analog converter does what its name implies. It’s necessary for the slew
rate of the DAC to match the acquisition rate of the ADC.
The smoothing filter is another low-pass filter that smoothes the output by removing
unwanted high-frequency components.
The last op-amp is just an amplifier.
The output transducer is a speaker in our case. You can use anything else according to
your requirements.
Compression of an image.
Enhancement, reconstruction, and restoration of an image.
Analysis or face detection (like Snapchat).
Speech Processing
Digital audio synthesis.
Speech recognition and analysis.
Medicine
X-rays, ECGs, EEGs.
Signal filtering
Noise removal and shaping of signal spectrums.
Military
Sonar and navigation.
Analysis after tracking in radars.
Consumer electronics
Music players
Professional music turntables (like the ones DJs use).
In this section we will encapsulate the differences between Discrete Fourier Transform
(DFT) and Discrete-Time Fourier Transform (DTFT). Fourier transforms are a core
component of this digital signal processing course. So make sure you understand it
properly. If you are having trouble understanding the purpose of all these transforms,
check out this simple explanation of signal transforms.
DTFT:
DTFT stands for Discrete-Time Fourier Transform. We can represent it using the
following equation. Read the equation carefully.
∞
∑ x(n)e
-jwn
X(w) =
n=-∞
N-1
-j2πkn
X(k) = ∑
n=0
x(n)e N
Probably the only things that you can notice in this equation are the fact that the
summation is over some finite series. Additionally, the exponential function seems to
have gotten a bit more complicated. Let’s address what these differences actually
translate to.
-j2πkn
DFT: X(k) = ∑N-1
n=0
x(n)e N
j2πkn
1 N-1
IDFT: x(n) = ∑n=0X(k)e N
N
The computation procedure for the above is quite complex.
To be pedantic, the DFT requires NxN complex multiplications and N(N-1) complex
2
additions. Without the twiddle factor, the computational complexity of DFT is O(n ).
With twiddle factors, the computational complexity is Nlog2N. Let’s keep this
information aside for a moment though.
Twiddle factors are mathematically represented as:
-j2π
WN = e N
Rewriting the equations for calculating DFT and IDFT using twiddle factors we get:
DFT:
N-1
X(k) = ∑x(n)W
n=0
nk
N
IDFT:
N-1
1
x(n) =
N ∑X(k)W
n=0
-nk
N
DFT or IDFT calculation, it is observed that the values of the twiddle factor repeat at
th
every N cycles. The expectation of a familiar set of values at every (N-1) step makes
the calculations slightly easier. (N-1 because the first sequence is a 0)
Alternatively, we can also say that the twiddle factor has periodicity/a cyclic property.
We’ll graphically see this below.
( ) = (e )
-j2π 0 -jπ 0
0 0
W4 = e 4 2 = e = cos0 + jsin0 = 1
= (e ) = (e )
-j2π 1 -jπ 1 -jπ
1 π π
W4 4 2 = e 2 = cos - jsin = 0 - j×1 = -j
2 2
= (e ) = (e )
-j2π 2 -jπ 2
2 -jπ
W4 4 2 =e = cosπ - jsinπ = -1 - j×0 = -1
= (e ) = (e )
-j2π 3 -jπ 3 -j3π
3 3π 3π
W4 4 2 =e 2 = cos - jsin = 0 - j×-1 = j
2 2
( ) = (e )
-j2π 4 -jπ 4
4 -j2π
W4 = e 4 2 =e = cos2π - jsin2π = 1 - j×0 = 1
th
As you can see, the value starts repeating at the 4 instant. This periodic property can is
shown in the diagram below.
0
W8 = 1
Similarly calculating for the remaining values we get the series below:
0
W8 = 1
1
W8 = 0.707-0.707j
2
W8 = -j
3
W8 = -0.707-0.707j
4
W8 = -1
5
W8 = -0.707+0.707j
6
W8 = j
7
W8 = 0.707+0.707j
8
W8 = 1
th
As you can see, the value starts repeating at the 8 instant. This periodic property can is
shown in the diagram below.
Problems on DFT:
1. Find the DFT of a sequence x[n]=[1,0,-1,0]
N=4
N-1
-j2πkn
X(k) = ∑
n=0
x(n)e N 0 ≤ k ≤ N-1
3
-j2πkn
X(k) = ∑x(n)e
n=0
4 0≤k≤3
3
-jπkn
X(k) = ∑x(n)e
n=0
2 0≤k≤3
3
-jπn -jπ0 -jπ1 -jπ2 -jπ3
For k = 1 →X(1) = ∑
n=0
x(n)e 2 = x[0]e 2 + x[1]e 2 + x[2]e 2 + x[3]e 2
-jπ1 -jπ3
0 -jπ
= 1×e + 0×e 2 - 1×e + 0×e 2 = 1 - 1×(cosπ-jsinπ) = 1 - (-1) = 2
= 1 - 1×(cos2π-jsin2π) = 1 - (1) = 0
3
-j3πn -j3π0 -j3π1 -j3π2 -j3π3
For k = 3 →X(3) = ∑
n=0
x(n)e 2 = x[0]e 2 + x[1]e 2 + x[2]e 2 + x[3]e 2
-j3π1 -j9π
0 -j3π
= 1×e + 0×e 2 - 1×e + 0×e 2 = 1 - 1×(cos3π-jsin3π) = 1 - (-1) = 2
*
Here, WN is the complex conjugate of the twiddle factor. To get the values of the
complex conjugate, just invert the signs of the complex components of the twiddle
factor. For example: The complex conjugate of 0.707+0.707j will become 0.707-0.707j.
From the convolution analysis, it is clear that, the duration of y(n) is L+M−1.
Matrusri Engg. College, Saidabad Dept.
of ECE
13
Digital Signal Processing
In frequency domain,
Y(ω)=X(ω).H(ω)
Now, Y(ω) is a continuous function of ω and it is sampled at a set of discrete
frequencies with number of distinct samples which must be equal to or exceeds L+M−1.
DFT size = N ≥ L+M−1
2π
With w = k,
N
Y(ω)=X(k).H(k), where k=0,1,….,N-1
Where, X(k) and H(k) are N-point DFTs of x(n) and h(n) respectively. x(n) & h(n) are
padded with zeros up to the length N. It will not distort the continuous
spectra X(ω) and H(ω). Since N≥L+M−1, N-point DFT of output sequence y(n) is
sufficient to represent y(n) in frequency domain and these facts infer that the
multiplication of N-point DFTs of X(k) and H(k), followed by the computation of N-point
IDFT must yield y(n).
This implies, N-point circular convolution of x(n) and h(n) with zero padding, equals to
linear convolution of x(n) and h(n).
Thus, DFT can be used for linear filtering.
Caution − N should always be greater than or equal to L+M−1. Otherwise, aliasing effect
would corrupt the output sequence.
Graphical interpretation:
Example:
x(n) = {1, 2, 3, 1}
h(n) = {1, 1, 1}
length(y(n)) = length(x(n)) + length(h(n)) -1
=4+3–1=6
Let us take two finite duration sequences x1(n) and x2(n), having integer length as N.
Their DFTs are X1(k) and X2(k) respectively, which is shown below
N-1
-j2πkn
X1(k) = ∑
n=0
x1(n)e N k = 0,1,2,3,……N - 1
N-1
-j2πkn
X2(k) = ∑
n=0
x2(n)e N k = 0,1,2,3,……N - 1
Now, we will try to find the DFT of another sequence x3(n), which is given as X3(k)
X3(k) = X1(k) × X2(k)
By taking the IDFT of the above we get
N-1
j2πkn
1
x3(n) =
N ∑ k=0
X3(k)e N
N-1
1
x3(n) =
N ∑x (m)x [((n-m)) ]
k=0
1 2 N
m=0,1,2,3,…….N-1
Multiply corresponding samples on the two circles and add them to get output.
Rotate the inner circle anti-clockwise with one sample at a time.
Let x1(n) and x2(n) are finite duration sequences both of length N with DFT’s X1(k) and
X2(k). Convolution of two given sequences x1(n) and x2(n) is given by the equation
x3(n) = IDFT[X3(k)]
N-1
Example:
Let’s take x1(n) = {1, 1, 2, 1} and x2(n) = {1, 2, 3, 4}
Arrange x1(n) and x2(n) in circular fashion as shown below.
x3(n) = IDFT[X3(k)]
N-1 N-1
1 1 3 2 1 1 2 6 2 11
x3(n) = 2 1 1
3 2
2 2 2 3 9
3 2 1 1 2 3 4 2 1 10
1 3 2 1 1 1 6 4 1 12
Suppose, the input sequence x(n) of long duration is to be processed with a system
having finite duration impulse response by convolving the two sequences. Since, the
linear filtering performed via DFT involves operation on a fixed size data block, the input
sequence is divided into different fixed size data block before processing.
The successive blocks are then processed one at a time and the results are combined
to produce the net result.
As the convolution is performed by dividing the long input sequence into different fixed
size sections, it is called sectioned convolution. A long input sequence is segmented to
fixed size blocks, prior to FIR filter processing.
Two methods are used to evaluate the discrete convolution −
Overlap-save method
Overlap-add method
Result of IDFT, where first M-1 Points are avoided, to nullify aliasing and remaining L
points constitute desired result as that of a linear convolution.
Properties of DFT:
All of these properties of the discrete Fourier transform (DFT) are applicable for discrete
-time signals that have a DFT. Meaning these properties of DFT apply to any generic
-j2πkn
↔ X(k)) where X(k) = ∑N-1
signal x(n) for which an X(k) exists. (x(n) DFT n=0
x(n)e N .
Property Mathematical Representation
Linearity ↔ a1X1(k) + a2X2(k)
a1x1(n)+a2x2(n) DFT
if x(n+N) = x(n) for all n
Periodicity
then X(k+N) = X(k) for all k
Time reversal ↔ X(N-k)
x(N-n) DFT
Duality x(n) ↔ Nx[((-k))N]
DFT
signal
Time reversal: Obtained by reversing samples of the
discrete-time sequence about zero axis/locating x(n) in
a clockwise direction.
1
Multiplication ↔ (X1(k)*X2(k))
x1(n) . x2(n) DFT
N
Complex conjugate ↔ X*(N-k)
x*(n) DFT
For even sequences:
X(k) = ∑N-1
n=0
x(n)Cos(2πnk/N)
Symmetry
For odd sequences:
X(k) = ∑N-1
n=0
x(n)Sin(2πnk/N)
1 N-1
Parseval’s theorem ∑N-1
n=0
x(n).y*(n) = ∑ X(k).Y*(k)
N n=0
X(k) = ∑x(n)W
n=0
nk
N
Let us take an example to understand it better. We have considered eight points named
from x0 to x7. We will choose the even terms in one group and the odd terms in the
other. Diagrammatic view of the above said has been shown below
Here, points x0, x2, x4 and x6 have been grouped into one category and similarly, points
x1, x3, x5 and x7 has been put into another category. Now, we can further make them in
a group of two and can proceed with the computation. Now, let us see how these
∑x(2r)W ∑x(2r+1)W
2rk (2r+1)k
X(k) = N
+ N
r=0 r=0
N N
-1 -1
2 2
= ∑x(2r)W
r=0
rk
N 2
+ ∑x(2r+1)W
r=0
rk
N 2
×WN
k
k
= G(k) + H(k). WN
Initially, we took an eight-point sequence, but later we broke that one into two parts G[k]
and H[k]. G[k] stands for the even part whereas H[k] stands for the odd part. If we want
to realize it through a diagram, then it can be shown as below
Example
In-Place Computation
This efficient use of memory is important for designing fast hardware to calculate the
FFT. The term in-place computation is used to describe this memory usage.
X[k] = ∑x[n]W
n=0
nk
N
Now let us make one group of sequence number 0 to 3 and another group of sequence
4 to 7. Now, mathematically this can be shown as;
N
-1
2 N-1
X[k] = ∑x[n]W
n=0
nk
N
+ ∑ x[n]W nk
N
n=N 2
X[k] = ∑x[r]W
r=0
rk
N 2
We take the first four points x[0], x[1], x[2], x[3] initially, and try to represent them
mathematically as follows
3 3
∑x[n]W ∑x[n+4]W
nk (n+4)k
8
+ 8
n=0 n=0
[ ]
3 3
= ∑x[n]+∑x[n+4]W
n=0 n=0
4k
8
×W8
nk
now
3
X[0] = ∑(x[n]+x[n+4])
n=0
3
X[1] = ∑(x[n]-x[n+4])W
n=0
nk
8
1
=(x[0]−x[4])+(x[1]−x[5]) W8+(X[2]−X[6])
2 3
W8+(X[3]−X[7]) W8
We can further break it into two more parts, which means instead of breaking them as 4
-point sequence, we can break them into 2-point sequence.
Cooley and Turkey were two mathematicians who came up with FFT – Fast
Fourier Transforms. This is a method of calculating DFT a bit faster.
To be precise, the FFT took down the complexity of complex multiplications from
2 N N
N to log2 .
2
Thus, the FFT (Fast Fourier Transform) is nothing but a more efficient way of
calculating the DFT (Discrete Fourier Transform).
The FFT is basically two algorithms that we can use to compute DFT.
o Decimation in Time algorithm (DIT).
o Decimation in Frequency algorithm (DIF).
The gist of these two algorithms is that we break up the signal in either time and
frequency domains and calculate the DFTs for each and then add the results up.
We have taken an in-depth look into both of these algorithms in this Digital Signal
Processing course.
How can we use the FFT algorithm to calculate inverse DFT (IDFT)?
Check out the formulae for calculating DFT and inverse DFT below.
-j2πkn
DFT: X(k) = ∑N-1
n=0
x(n)e N
j2πkn
1 N-1
IDFT: x(n) = ∑k=0X(k)e N
N
As you can see, there are only three main differences between the formulae.
In DFT we calculate discrete signal X(k) using a continuous signal x(n). Whereas
in the IDFT, it’s the opposite.
In the IDFT formula, we have two different multiplying factors.
o The factor 1/N
-nk nk
o The factor WN which is the complex conjugate of the twiddle factor WN .
Thus if we multiply with a factor of 1/N and replace the twiddle factor with its
complex conjugate in the DIF algorithm’s butterfly structure, we can get the IDFT
using the same method as the one we used to calculate FFT.
In this case, DIF and DIT algorithms are the same.
We’ll see the modified butterfly structure for the DIF FFT algorithm being used to
calculate IDFT.
From the above butterfly diagram, we can notice the changes that we have
incorporated. The inputs are multiplied by a factor of 1/N, and the twiddle factors
are replaced by their complex conjugates.
0 0
W8 = 1 W8 = 1
1 -1
W8 = 0.707-0.707j W8 = 0.707+0.707j
2 -2
W8 = -j W8 = j
3 -3
W8 = -0.707-0.707j W8 = -0.707+0.707j
4 -4
W8 = -1 W8 = -1
5 -5
W8 = -0.707+0.707j W8 = -0.707-0.707j
6 -6
W8 = j W8 = -j
7 -7
W8 = 0.707+0.707j W8 = 0.707-0.707j
8 -8
W8 = 1 W8 = 1
What is Inverse Fast Fourier Transform (IFFT)?
This method of using the FFT algorithms to calculate Inverse Discrete Fourier
Transform (IDFT) is known as IFFT (Inverse Fast Fourier Transform).