Anda di halaman 1dari 63

DSP Algorithms and

Architecture (06EC74)
Reference Text : DSP by Avathara Singh and
S Srinivasan
UNIT 1
Contents
1.Introduction to DSP
2.A DSP System
3.Sampling Process
4.DFT
5.FFT
6.LTI- systems
7.Digital Filters
8.DECIMATION and INTERPOLATION
What is a signal?
A function of independent variables such as
time, distance, position, temperature, pressure,
etc.
A signal carries(coveys) information.
Examples: speech, music, seismic, image and
video.
A signal can be a function of one, two or N
independent variables
Speech is a 1-D signal as a function of time
An image is a 2-D signal as a function of space
Video is a 3-D signal as a function of space and
time





Discrete Sequences (Discrete-Time Signals)

Types of Signals
Analog Signals (Continuous-Time Signals)


Signals that are continuous in both the dependant and
independent variable (e.g., amplitude and time). Most
environmental signals are continuous-time signals.
Signals that are continuous in the dependant variable
(e.g., amplitude) but discrete in the independent
variable (e.g., time). They are typically associated with
sampling of continuous-time signals.

Signals that are discrete in both the dependant and
independent variable (e.g., amplitude and time) are
digital signals. These are created by quantizing and
sampling continuous-time signals or as data signals
(e.g., stock market price fluctuations).

Types of Signals (cont.)
Digital Signals

Types of Signals (cont.)
What is DSP?
Converting a continuously changing
waveform (analog) into a series of
discrete levels (digital)
What is DSP?
The analog waveform is sliced into equal
segments and the waveform amplitude is
measured in the middle of each segment.

The collection of measurements make up
the digital representation of the waveform.
What is DSP?
0
0
.
2
2 0
.
4
4 0
.
6
4
0
.
8
2
0
.
9
8
1
.
1
1
1
.
2
1
.
2
4
1
.
2
7
1
.
2
4
1
.
2
1
.
1
1
0
.
9
8
0
.
8
2
0
.
6
4
0
.
4
4
0
.
2
2
0
-
0
.
2
2
-
0
.
4
4
-
0
.
6
4
-
0
.
8
2
-
0
.
9
8
-
1
.
1
1
-
1
.
2
-
1
.
2
6
-
1
.
2
8
-
1
.
2
6
-
1
.
2
-
1
.
1
1
-
0
.
9
8
-
0
.
8
2
-
0
.
6
4
-
0
.
4
4
-
0
.
2
2
0
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
1 3 5 7 9
1
1
1
3
1
5
1
7
1
9
2
1
2
3
2
5
2
7
2
9
3
1
3
3
3
5
3
7
Converting Analog into Digital
Electronically
The device that does the conversion is called
an Analog to Digital Converter (ADC).
There is a device that converts digital to analog
that is called a Digital to Analog Converter
(DAC).
Changing or analyzing information that is
measured as discrete sequences of numbers.
The representation, transformation, and
manipulation of signals and the information they
contain.
Unique Features of DSP
Signals come from the real world
Need to react in real time
Need to measure signals and convert them to
digital numbers
Signals are discrete
Information in between discrete samples is
lost

Processing Real Signals
Most of the signals in our environment are
analog such as sound, temperature and light
To processes these signals with a computer,
we must:
1. convert the analog signals into
electrical signals, e.g., using a transducer
such as a microphone to convert sound into
electrical signal
2. digitize these signals, or convert them
from analog to digital, using an ADC (Analog
to Digital Converter)
Processing Real Signals (cont.)
In digital form, signal can be manipulated
Processed signal may need to be
converted back to an analog signal before
being passed to an actuator (e.g., a
loudspeaker)
Digital to analog conversion and can be done
by a DAC (Digital to Analog Converter)

Block Diagram for DSP
Fig: Block Diagram of DSP

A/ D
D/A
Anti aliasing
Filter
Analog
Sampled
Data
Signal
Digital
Signal
Analog
DSP
Reconstructi
on Filter
Anti aliasing filter:
signal to be sampled does not contain any
frequency higher than half of the sampling
frequency.

if not used, high frequency contents, sampled
with an inadequate sampling rate generate low
frequency aliasing noise.
Process:
Analog signal is a continuous-time, continuous-
amplitude signal which can be defined for any time
and can have any amplitude.
Sampling process generates a sampled signal.
A sampled signal value is held by a hold circuit to
allow an A/D converter to change it to the
corresponding digital signal.
The processed digital signal as obtained from DSP,
is the input to D/A converter.
The output of D/A converter has Staircase
amplitude due to conversion process used in such a
device.
The signal as obtained from D/A, can be passed
through reconstruction filter, to remove its high
frequency contents and hence smoothen it.
Sampling process:
The process of converting an analog signal to
a digital signal involves.

Sampling the signal.
Holding it for conversion.
Converting it to the corresponding digital value.
Periodic or uniform sampling:
Described by x(n)=x
a
(nT) ; - < n <
Where,
X(n)= Discrete time signal obtained by taking samples
of the analog signal x
a
(t) every T seconds.
The time interval T between successive samples is
called sampling period. And its reciprocal 1/T = Fs =
Sampling rate or sampling frequency.
t & n are related through t=nT=n/Fs
To establish a relationship between the frequency
variable F() for analog signals and the frequency
variable f(w) for DTS.
Consider the analog signal
X
a
(t) =A cos(2tft + u)
When sampled at the rate F
s
= 1/T
The sampled signal is
Xa(nT) = X(n)= A cos(2tfnT + u)
= A cos (2tn f/Fs +u) [T = 1/F
s
] -------- (a)
The digital frequency = analog freq. X sampling
anlaog
f is digital

Range for analog signals: - < f <
- < <

s
F
f
F
=
However for Discrete time sinusoids;
- < f <
< w <
Note: the highest rate of oscillation in a discrete
time Sinusoid is attained when
w= (or w = - ) or equivalent
f = (or f = -1/2)



Sampling theorem:
A continuous-time signal x(t) with frequencies
no higher than f
max
(Hz) can be reconstructed
EXACTLY from its samples x [n] = x (nTs), if
the samples are taken at a rate f
s
= 1/Ts that is
greater than 2fmax.
Consider a band-limited signal x(t) with Fourier
Transform X()

Sampling x(t) is equivalent to multiply it by train of impulses
Frequencies above or below f s/2 results in
samples that are identical with a corresponding
frequency in the range
- Fs/2 F Fs/2
To avoid the ambiguities resulting from aliasing,
we must select sampling rate to sufficiently
high.
i.e., Fs/2 to be greater than F max
Fs/2 > F max
Fs>2 F max [F = 2 F max, is called the Nyquist
rate]
A/D Converter:
Digital signal is a sequence of numbers
represented by finite number of digits.
The process of converting a discrete time
continuous amplitude signal into a digital signal
by expressing each sample value as a finite
(instead of infinite) number of digits, is called
Quantization. Xq(n) = Q[x(n)]
Quantization error eq(n) defined as the
difference between the quantized value and
the actual sample value. Thus Rq(n) = Xq(n)
X(n).
Coding: coding process assigns a unique
binary number to each quantization level.
If L levels -> L different binary numbers with
word length of b bits we can create 2
b
numbers.
2
b
L or b log
2
L

Discrete-time Sequences
Let x(t) = A cos 2fT is sampled using T as the
sampling interval; it yields
X(nT)= A cos 2fnT, where n=0,1,2,----
X(n) = A cos 2f nT
Since fs = 1/T; 0 = 2ft;
X(n) = A cos 2fn/fs = A cos 0n

0 = denotes digital frequency
0 = 2ft
0 = 2f/fs [fs>2fmax]




This is called sinusoidal sequence
Complex exponential sequence;
P(n) = e
j2n/N
; n= -1,0,1,2.. etc.
Where N is an integer
Sinusoidal sequence x(n) has the period f
s
/f
Exponential sequence P(n) has the period
equal to N samples.
The frequency response associated with a time
domain N-point sequence x(n) can be
determined from;


1
0
( ) ( )
N
j jn
n
X e x n e
0 0

=
=

Discrete Fourier transforms:


Frequency analysis of DTS is usually performed
on digital signal processor.
To perform frequency analysis, time domain
sequence is converted to frequency domain
representation.
This is given by fourier transform x(w).
However it is a continuous function.
DFT is used to transform a time domain x(n)
sequence to a frequency domain x(r)

DFT Pair
x(n) and X(K) are related by.
DFT and IDFT are related by.

( ) ( ) x n X K

Relationship between DFT and
frequency response:

From

Frequency response of a sequence & its DFT
are related as follows



Points of X(K) are spaced at a digital frequency
of radians

1
0
( ) ( )
N
j jn
n
X e x n e
0 0

=
=

2
( ) ( ) |
0,1, 2, ( 1)
j
k
n
X K X e
k N
u

0=
=
=
2
n

Fast Fourier Transform


DFT and IDFT require a large number of
complex multiplies.
FFT is an fast algorithm to efficiently compute
DFT and IDFT; which uses the Periodic nature
of W
N

nk
[e
j2nk/n
]






2
1
0
( ) ( )
0,1, 2... 1
j nK
N
N
n
X K x n e
K N
t

=
=
=

For 1-pt DFT


it requires N complex Multi and N-1 complex
addn.
For N-pt DFT
it requires N
2
complex Multi and N(N-1)
complex addn.
Using FFT
N/2 log
2
N Multi and
N log
2
N addn.
Application: FFT can be use it to compute
signal power spectral density(PSD) or Signal
spectrum




Linear Time Invariant Systems
A system that has same input output relation at
all times is called a Time Invariant System.

LTI systems are characterized by its impulse
response or unit sample response in time
domain whereas it is characterized by the
system function in frequency domain.

In time domain, LTI system can be represented
using Linear Constant Co-efficient difference
equations

In frequency domain, system transfer function is
used to represent such a system
Convolution
Convolution is the operation that relates the
input output of an LTI system, to its impulse
response.

The output of the system y (n) for the input x (n)
and the impulse response of the system being h
(n) is given as
y (n) = x(n) * h(n) = x(k) h(n-k)

1
0
( ) ( )
N
j jn
n
X e x n e
0 0

=
=

The frequency response associated with N-


point sequence.


The Z Transform for a discrete sequence x
(n) is given by,

N-1
X (Z)= x(n) Z
-n

n=0

X (Z) represents frequency response in terms of Z .

Z Transformation
The System Function
Y(n) = x(n) * h(n)
The system function of a system is the ratio of
the Z transformation of its output to that of its
input.
It is denoted as H (Z) and is given by
H (Z) = Y (Z)/ X (Z)
The magnitude and phase of the transfer
function H (Z) gives the frequency response
of the system.

Digital Filters
A filter is a sequence h(n) that operates on an
input sequence x(n) to generate a filtered
output sequence y(n).
The general difference equation for an Nth
order filter is given by,
N

L
y (n) = a
k
y(n-k)+ b
k
x(n-k)

k=1

k=0

The above equation can be realized in a block diagram




Fig: Structure of a Digital Filters
FIR Filters
In FIR filters the present output depends
only on the past and present values of the
input sequence but not on the previous
output sequences.

L
y (n) = b
k
x(n-k)

k=0
Dependent on number of Filter co-efficients
represented by b
k
The frequency response of an FIR filter is given
as
L
H(e
j
)= b
k
e
-jk
k=0
In terms of Z-transform

L
H(Z)= b
k
Z
-k
k=0
Since no feedback in its structure, it is always stable

FIR filter is a stable filter since it has no
feedback
Symmetric co-efficient filter provides linear
phase.
The major drawback of FIR filters is, they
require more number of filter coefficients to
realize a desired response as compared to IIR
filters. Thus the computational time required will
also be more.




IIR Filter
N L
y (n) = a
k
y(n-k)+ b
k
x(n-k)

k=1

k=0

Its transfer function is given by



It has Feedback
Stability depends upon the number & values of
Co-efficient


1 2 3
0 0 1 2
1 2 3
1 2 3
........
( )
1 ........
L
L
N
N
b b Z b Z b Z b Z
H Z
a Z a Z a Z a Z


+ + + + +
=

Advantage
- Small number of co-efficients
- Hence shorter computation time
- can handle larger bandwidth.



Obtain the transfer function of the IIR
filter whose difference equation is
given by
y (n)= 0.9y (n-1)+0.1x (n)
Soln: Taking Z transformation both sides
Y (Z)= 0.9 Z
-1
Y(Z) + 0.1 X(Z)
Y (Z) [ 1- 0.9 Z
-1
] = 0.1 X(Z)
The transfer function of the system is given by
H (Z)= Y(Z)/X(Z) = 0.1/ [ 1- 0.9 Z
-1
]
H (Z)= 0.1Z/ (Z-0.9)
FIR Filter Design

L
H(e
j
)= b
k
e
-jk
k=0
Design procedure of an FIR filter involves the
determination of the filter coefficients bk.


bk = (1/2) H (e
j
) e
-jk
d

-
The impulse response b
k
as obtained by solving the
above equation may be extremely long and may have to
be truncated

The truncation results in a distortion called
Gibbs phenomenon, that introduces
ripples in the pass band of a filter
frequency response.

To control Gibbs phenomenon special
truncation windows are used.

Decimation and Interpolation
Several applications need convert the signal of
given sampling rate to an equivalent signal with
a different sampling rate.
Eg: In digital audio , different sampling rates used
are 32KHz for Broadcasting
44.1 KHz for Cd
Different Sampling rates can be obtained
using an Up-sampler and Down sampler.
Basic operations to achieve this are
Decimation and Interpolation .


Decimation : reducing the Sample rate.
Interpolation :Increasing the Sample rate

Sampling rate Conversion Methods
1.
Digital Signal
Analog Signal
D/A Converter Linear Filter A/D Converter
Digital Signal
Digital signal is made to pass through a D/A converter, then
filtered & then resample at the desired sampling rate.

Resampling is done using A/D converter
2.
Sampling rate conversion is carried out entirely
in digital domain
Doesn't require D/A and A/D converters
This method uses interpolator or Decimator or
both depending upon the sampling rate
conversion factor.


Sampling Rate Conversion process

If x(n) is a sequence with a sampling rate of F
T

Hz.
Another sequence y(n) is required with a desired
sampling rate of F
T
1
Hz.
Then the sampling rate alteration ratio is given by


If R>1 process is called Interpolation results in a
sequence with higher sampling rate
If R<1 process is called Decimation. Sampling
rate is decreased
1
T
T
F
R
F
=
In Up-Sampling: Interpolation
Interpolation by an integer factor L>1
L-1 equidistant Zero valued samples are inserted
between each two consecutive samples of input
sequence x(n)
Also called as sampling rate expander
Interpolation process
Problem
Let x(n)= [0 3 6 9 12] be interpolated with L=3.
If the filter coefficients of the filters are b
k
=[1/3
2/3 1 2/3 1/3], obtain the interpolated sequence

Soln : After inserting zeros,
w (m) = [0 0 0 3 0 0 6 0 0 9 0 0 12]

b
k
=[1/3 2/3 1 2/3 1/3]
2
y(m)=b
k
w(m-k) = b
-2
w(m+2)+ b
-1
w(m+1)+
k=-2 b
0
w(m)+ b
1
w(m-1)+ b
2
w(m-2)
Substituting the values of m, we get
Down Sampling: Decimation
Decimation by an integer factor M>1
Keeping every M
th
sample of x(n) &
removing M-1 in between samples
Generates an o/p sequence y(n) according
to the relation
y(n)=x(nM)


Decimation and Interpolation
Decimation---down-sampling
N
) ( ) ( mN x m y =
x(n)
Decimation and Interpolation
N
) ( ) ( mN x m y =
Decimation---down-sampling
Decimation and Interpolation
N
) ( ) ( mN x m y =
y(m)
Decimation---down-sampling

Anda mungkin juga menyukai