Lecture Notes ٠٧٢٨٣٢
Lecture Notes ٠٧٢٨٣٢
Signal Processing
Digital Signal Processing and Computer Network
1.1 Introduction
Signal and systems representation, representation of signals in
time, sampling and analog to signal conversion.
1.2 Time domain analysis
Linear time invariant systems, impulse response and convolution
sum.
1.3 Frequency Domain Analysis and Z-Transform
Linear constant-coefficient difference equation, Fourier transform
and frequency response, z-transform.
1.4 Discrete Fourier Transforms (DFT) and FFT
Signal analysis and synthesis based on DFT, Fast Fourier
Transform (FFT).
1.5 Filter Analysis
Fundamental structures of digital filter.
1.6 Infinite Impulse Response (IIR) Digital filter
1.7 Finite Impulse Response (FIR) Digital Filter
1
Computer Network
2.1 Introduction
Internet architecture, OSI and TCP / IP reference models, network
history and standardization, network topology, LAN, MAN and WAN.
2.2 Physical Layer
Theoretical basis, various transmission medias, various well know
networks, multiplexing, switching.
2.3 Data link layer
Framing, error control (detection and correction), flow control.
2.4 Network layer
Routing, network control, IP protocols, routing and control protocols.
2.5 Transport layer
Reliable end – end data transfer principles, flow control, end-end
congestion control, UDP, TCP.
2.6 Application layer
WWW, FTP, Email, DNS, Multimedia.
2.7 Network security
Text Books
[1]Introduction to digital signal processing with computer application,
Paul Lynng 1993.
[2] Digital Signal Processing, Li Tan 2008.
[3] Data Communication and computer Network Behrous Feourozon,
2007.
2
1. Introduction
1.1 The scope of digital signal processing (DSP)
1.1 DSP techniques are now used to analyze and process signals and
data arising in many areas of engineering, science, medicine, economics
and the social sciences.
1.3 The general purpose computer can be used for illustrating DSP
theory and application. However, if high speed real time signal
processing is required, it may use special purpose digital hardware.
1.4 Various terms are used to describe signals in the DSP environment.
3
1.5 Discrete time signals may be divided into two categories:-
1.7 In practice, the term discrete time signal and digital are often used
interchangeably.
x[n] y[n]
x[n] y[n]
DSP
n=0 T nT n
4
1.8 Fig (1.2) shows a typical DSP block diagram.
Examples of input signals might be analog voltage temperature,
pressure or light intensity.
a. If the signal is not electrical, it is first converted to a proportional
voltage variation by a suitable transducer.
b. Analog filter, is used the first stage in the block diagram to limit
the frequency range of the signal prior to sampling.
c. The signal isnext sampled and converted into a binary code by an
analog to digital converter (ADC). After digital signal processing it
may be changed back into analog form by DAC. Analog filter is
used the final stage to remove sharp transitions from the DAC
output.
d. After DSP the signal may be used to drive a computer display, or it
may be transmitted in binary form to a remote terminal or location.
Fig (1.2) A typical DSP block diagram.
Analog Analog
input Analog ADC DSP DAC Analog output
filter filter
y[n] = F { } …… (1.1b)
5
y[n]= F{x[n] + x[n-1] + x[n-2] + ……….. + x [n-N]}
y[n] = F { } ……… (1.1)
Equation (1.1):-
a) is a recurrence formula, which is used over and over again to fined successive
values of y.
b) It is also called a difference equation.
c) It is nonrecursive, because each output is computed simply form input values.
d) It is used to define filters if each term multiplied by a constant or variable
number [F].
2.2 The above algorithm described by eq(1.1) is not very efficient because of each
output value is exactly the same as the one before it, except that the most recent
input sample is included.
Eq (1.1) can be smoothed the output signal y[n] by
y[n+1] = y[n] + F {x[n+1] – x[n-N]} ….. (1.2)
Since eq (1.2) is a recurrence formula which applied for any value of n,
we may subtract (1) from each term in square brackets, giving
y[n] = y[n-1]+F{x[n] – x[n-N-1]} ….. (1.3)
Eq (1.3):-
a) Confirms that we can estimate each output sample by updating the
previous output y [n-1].
b) The equation defines a recursive version of the filter which is more
efficient, required fewer addition and subtraction.
6
1.3. Sampling and Analog to Digital Conversion
1.3.1 Suppose that an analog signal is to be represented by a set of
equally spaced samples.
Fig (1.3.a) shows a signal sampled at a rate which is clearly too low to
pick out the more rapid fluctuations.
Fig (1.3.b), sampling appears unnecessarily fast.
A great many samples values would have to be stored, processes or
transmitted.
x[n] x[n]
n
n
....... (1.4)
7
1.3.3 Alternatively, if we have a digital system with sampling interval T, the maximum analog
frequency is called the Nyquist frequency and is given by
……… (1.5)
3.4 Fig (1.4a) represents the frequency distribution or spectrum of an analog speech signal. There
are no components above maximum frequency.
/ H(f) /
(a) =3
0 3 ( )
/ H(f) /
Reconstructed filter
(b) =2 =6
0 3 6
(c)
<2 =5
f
Fig (1.4) The effects of sampling on a signal spectrum.
From fig (1.4) can be concluded:-
a) The spectrum as an even function, extending to negative frequencies. This widely used
representation results from expressing each frequency component as the sum of two
exponentials. Thus a component Acoswt may be written as
( )= + …. (1.6)
b) Reconstructing filter is used to recover the original signal. The filter type is low pass filter.
8
1.3.5 In most electronic DSP applications, sampling is performed by an
analog to digital converter (ADC), which also transforms the stream of
samples into a binary code. The binary code N bit long
allows2 separate numbers. Thus if N=8, we may encode2 = 256,
discrete values.
1.3.6 Analog signals normally take on a continuous range of amplitudes,
so when they are sampled and binary coded small amplitude errors are
bound to be introduced as shown in fig (1.5) with 3 bite code.
Sample value 3 47 6 x[n]
Binary code 011 100 111 110 7
6
Fig (1.5) Converting an analog 5
signal into a binary code (3bite) 4
3
2
1
0 n
1.3.7 Fig (1.5) shows the following note:-
a) With 3 bit code, the separate sample values are 8. The total amplitude
range is divided into 8 quantization levels or slots.
b) The maximum error introduced into each sample value by this process
is± half quantization level. With 3 bite code the error ± of the total
9
1.3.8 After a signal has been processed digitally, it may be converted back to an
analog voltage using a digital to analog converted (DAC).
a) Each signal sample value, corresponding to the binary code delivered to the
DAC input, is held drawing the following sampling interval.
b) The resulting staircase waveform is suitable for many practical applications
(including the computer plots).
c) If a true analog output is required, a further smoothing filter must be employed
in order to obtain fully reconstructed signal.
2
n
7
5
DAC output
2
Time
Analog signal
Time
10
1.4. Basic type of digital signal
n]
1
fig (1.8) unit impulse function n
The relationship between unite step and unite impulse is given by
…. (1.9)
11
recurrence
formula:
– u[n-1] … (1.10)
Eq(1.10) holds good for all integer values of n.
for n<0
n
fig (1.9) The unit ramp function.
Ex 1.1Find expression for the following signal.x[n]
a) This is a unit step function which has been scaled
(Weighted) by of -2, it starts at n= - 4, rather than
n=0, and it is time reversed. n
-2
b) Scaling by -2gives the function -2u[n]
c) Time shifting so that it starts at n=-4
gives the function -2u[n=-4]
d) Reversal gives the function -2u[-n-4].Hence the required function is
[ ]= 2 [ 4] since [ ] = 1 >0
= 2 [ ( + 4)] = 0 <0
in this case reversal
12
Ex 1.2 Find expression for the following signal x[n]
Solution
13
1.4.4 Exponential, sine and cosines signal
a) Exponential signals are used in analysis and often occur in the natural world and
in technology.
In the DSP context, sampled exponentials are used as a powerful set of frequency
domain techniques to analyze and process signal and to design the system.
The exponential signal is defined by
…. (1.12)
Where A and are constants.
n n n
fig (1.10) Basic digital signal real exponentials.
c) Such real exponentials theoretically continue forever in both directions. In
practice, we work with defined signals in time such as
[ ] = Ae 0 …. (1.13)
0 <0
we can make use
0, if multiply or modulate an exponential by u[n], then x[n]
[ ]= [ ] …. (1.14)
d) The successive sample values from a simple geometric progression each value
[ ]= = =
Hence [ + 1] = =[ ] = [ ] …. (1.15)
14
e) If we 1.12) to be purely imaginary.
Let us consider 1.16)
Where = 1,
= =
…….. (1.17)
Eq (1.17) contains a cosin real part and sin imaginary part. However we
-
[ ]= = cos( ) ( )
f) By adding ,
[ ]+ [ ]= cos( )+ ( )+
cos( ) ( )
[ ]+ [ ]=2 cos( ) …. (1.18)
1 1
cos( )= [ ]+ [ ]
2 2
( ) ( )
….. (1.19)
This result shows that a sampled cosine signal can be made up from a
pair of sampled imaginary exponentials
g) By subtracting and
=2 ( )
( ) ( )
( )= … (1.20)
15
What is the difference between sampled sine and cosines and their
counterpart?
1) Analog sine and cosine signals are oscillatory and periodic sample sines and
cosines, however, are not necessarily periodic. Although their sample values lie on
a periodic envelope, the numerical values may not form a repetitive sequence. Fig
(1.11a) shows a discrete time sinusoid and fig (1.11b) shows a discrete time
cosinusoid both are periodic but fig (1.11c) shows a discrete time samples lies a
long a sinusoidal envelope, does not have repeating numerical values.
Exact repetition will only occur if the sampling interval bears some simpler
relationship to the repetition time or period of the analog signal. This means that
[ ] ( ) ( )
[ ]= = = … (1.21)
But
…… (1.22)
16
x[n] x[n]
n n
…. (1.24b)
….. (1.26)
Thus the sample series may be generated if both f and are know.
17
Ex (1.5) Sketch carefully, and defined the values for each samples of the
following signals:-
a) [ ] = (0.2 ) b) [ ] = cos( )
c) [ ] = ( ) ( ) d) [ ] = cos( ) [ ]
x[n](1.22)
1.22
1
0.22
n
n
(a) (b)
n n
(c) (d)
18
1.6. Linear Time Invariant (LTI) System Properties
1.6.1 A linear system or processor may be defined as one which obeys
the principle of superposition. If an input consisting of the sum of an
number of signals is applied to a linear system, then the output is the
sum or superposition of the system's response to each signal considered
separately.
Let as consider an input [ ]applied to a digital processor produced
[ ]and that input [ ] produced output [ ]. Then the process are is
linear if its response to { [ ] + [ ]} is { [ ] + [ ]}.
1.6.2 Furthermore, if an input [ ]produced output ay[n] where a is
constant coefficient or multiplier or a weighting factor.
In general the weighted sum of inputs
[ ]+ [ ]+ [ ]+ must produce the weighted sum of
outputs
[ ]+ [ ]+ [ ]+
Let us consider a system which squares each sample value applied to its
input. Thus for two different inputs applied separately, we have
= ( [ ]) = ( [ ]) …. (1.27)
When the same two inputs are summed, and applied simultaneously, the output is
={ [ ]+ [ ]}
= { [ ]} + { [ ]} + 2 [ ] [ ] … (1.28)
19
Eq(1.28) is not the sum of its responses to [ ] [ ] applied
separately.
1.6.3 Frequency Preservation: - It means that if we apply an input signal
containing certain frequencies to a linear system, the output can contain
only the same frequencies and no others. The property depends upon the
fact a sampled sinusoid, applied to any linear processor; produce a
similar form of output.
This property does not hold for the squaring system mentioned above.
[ ] = { [ ]} = [ ] …. (1.29)
1 1 1
= {1 + cos[2 ]} = + cos [2 ]
2 2 2
Thus there is no component in output at frequency =
1.6.4 Time Invariance:-A time-invariant system is one whose properties
do not vary with time. The only effect of a time shift in an input signal to
the system is a corresponding time shift in its output. The majority of
technological systems and processes are of this type.
6.5 Association and Commutation
Association property means that we may analyze a complicated LTI
system by breaking it down into a number of simpler subsystems. Also,
we can synthesize an overall system perhaps a very complicated one by
designing a number of independent subsystems.
20
The commutative property of LTI systems means that if the subsystems
are arranged in series or cascade, then they may be arranged in any order
without affecting overall performance. This property advantages to
reduce the complexity.
1.7. Other System Properties [Causality, Stability Invertibility and
Memory]
1.7.1 Causality: In a causal system, the output signal depends only on
present and/or previous values of the inputs. Most practical signal
processors are casual. However, if we record a signal on data and
subsequently process by computer, the software need not be causal.
Ex. y[n]=x[n]+x[n-1] causal
y[n]=x[n]+x[n+1] noncausal
7.2 Stability: A stable system is one which produces a finite or bounded
output in response to a bounded input.
1.7.3 Invertibility: If a digital processor with input x[n] gives an output
y[n], then its inverse would produce x[n], if fed with y[n]. The most
practical system is invertible. An exception in the squaring device
mentioned earliest for which
[ ] = { [ ]}
1.7.4 Memory: A processor possesses memory if its present output y[n]
depends upon one or more previous input values x[n-1], x[n-2], …..
21
Ex (1.6) x[n] and y[n] are the input and output signals of a DSP system.
Determine which of the following properties and possessed by systems
defined by the recurrence formula (a) and (d) below:-
Linearity Invertibility Stability
Causality Time Invariance Memory
a) y[n]= 3x[n] – 4x[n-1]
b) y[n] = 2y[n-1] + x[n+2]
c) y[n] = n x[n]
d) y[n] = cos[x[n]]
Solution
a) – The output is a weighted sum of present and previous inputs
- It is bounded if the input is bounded.
- Thus the system has all six properties mentioned above.
b) – The present output depends on a future input, so the system is not causal.
- If the input signal ceases, the output goes on rising without limit, since each
output value twice the previous one. Therefore the system is unstable.
- However a possess the other properties mentioned above namely: linearity,
time-invariance, invertibility and memory.
c) – The output depends on the present input only, so the system has no
memory.
- Since it also depends on the independent variable, the system is time-variant
- But the system have the properties of linearity, causality, stability and
invertibility.
22
d) y[n] = cos[x[n]]
– A cosine function is periodic; so many different values of x[n]
would produce the same value of y[n]. Hence the system is not
invertible.
- It is not a linear because if we double x[n], we do not double y[n].
- Since y[n] depends only on x[n], the system has no memory.
- However, it is time invariant, causal and stable.
1.8. Classification of Signals
1.8.1 Deterministic and Random Signal
A signal can be classified as deterministic, meaning that there is no
uncertainty with respect to its value at any time or as random that there
is some degree uncertainty before the signal actually occurs.
23
1.8.4 Analog and Digital Signals
a) Analog signal amplitude can take on an infinite number of values.
b) Digital signals can take only a finite number of values.
c) The term continuous time and discrete time define the nature of the signal along the time
(horizontal axis).
The terms digital and analog define the nature of the signal amplitude (vertical axis).
Fig (1.11) shows examples of various types of signals.
g(t) g(t)
time time
Analog continuous time Digital continuous time
time time
Analog discrete time Digital discrete time
b) A signal is defined as a power signal if it has nonzero but finite power (0 <
< ) for all time where
/
= /
( ) …… (1.31)
In general:-
a) Periodic and random signal are classified as power signals.
b) Deterministic and nonperiodic signal classified as energy signals.
24
Time Domain Analysis
2.Time Domain Analysis
2.1 Introduction
The basic techniques for describing digital signals and processors in the time domain
are:-
a) Convolution:- allows us to find the output signal from any LTI processor in
response to any input.
b) Impulse response:- this is the response of the processor to the unit impulse
response
The time domain methods are used for analysis and are not a great help in designing
new processor. The main reason is that the design specifications are based on
performance in the frequency domain. The convolution takes place in the time
domain, without any need to consider the frequency components of the input signal
and processor.
The digital signal x[n] is shown in fig(2.1) and it is clear that x[n] may be considered
as the superposition or summation of the more basic impulse signals shown in parts
-1] x[n]
(e) fig(2.1) (a)
n
n
-2 -1 0 1 2 -2 -11 0 1 2
-2] x[-
(b)
(f)
n
n
-2 -1 0 1 2n -2 -1 0 1 2
x[-
Each of these is a unit impulse shiftedx[-
(c)
by 'n' samples which has been weighted
n
by the value of x[n] [ i.e the value of -2 -1 0 1 2
-2 -1 0 1 2 n
1
Thus each of these signal shown in fig(a-f) is a unit impulse which has been weighted
by the appropriate value of x[n] [ i.e the value of x[n] is shown in part a], and shifted
by a number of sampling intervals.
[ ]= [ ] [ ]…… (2.2)
Where the integer K takes all value between ±
signal.
elsewhere.
the input of digital processor, (the excitation) is confined
to the instant n=0.
Any output signal observed after n=0 must be characteristics of the processor
itself.
The impulse response is given by the symbol h[n].
If the input to a linear processor is
fig (2.2).
From impulse response can be determined the system properties such as
causality,stability and memory.
2
h(n)
Digital LTI
processor
memoryless noncausal
n n
Ex 2.1
Find the first three sample values of the impulse response h[n]for the system defined
by the following difference equation
3
Solution if the system causal, then h[n]
But
y[n]=1.5y[n-1]-.85y[n-2]+x[n]]
It is simple to find the value of each term of h[n] for a given value
of n
If n=0 , substitute n=0 in eq(2.3)
[0] = 1.5 [ 1] 0.85 [ 2] + [0]
=0–0+1=1
4
EX 2.2 Find the first three sample values of the impulse response h[n] for
the system shown in figure
x(n) + y(n)
-0.9
T
Solution:-
zero otherwise
[0 ] = 0.9 [ 1] + [0]
= 0 + 1 =1
[1] = 0.9 [0] + [1]
[1] = 0.9 × 1 + 0 = 0.9
[2 ] = 0.9 [1] + [2]
[2 ] = 0.9 × 0.9 + 0 = 0.81
[3] = 0.9 [2] + [3]
[3 ] = 0.9 × 0.81 + 0 = 0.729
Thus each sample value is -0.9 times the previous one, and h[n] therefor
follows decaying real, exponential envelope, with alternate sample.
5
EXP 2.3 find the first four sample values of the impulse response h[n] for the system
defined by the following equation
[ ]= [ ]+ [ 1] + [ 2] +
Solution:-
This is a nonrecursive system, since no feedback in the equation
[ ]= [ ]+ [ 1] + [ 2] +
[0] = [0] + [ 1] + [ 2] +
[0] = 1 + 0 + 0 + =1
= 0+1+0… = 1
Similarly h[2] =h[3] =1 and so on. The impulse response therefor equals
the unit step.
[ ]= [ 1] + [ ]
Solution:-this is a recursive system, since there is a feedback in the
equation
[ ]= [ 1] + [ ]
[0] = [ 1] + [0] = 0 + 1 = 1
6
2.3.2The Step Response
The unit step function u(n) is the running sum of the unit
…. (2.5)
A step response gives essentially the same information as an
impulse response, but in slightly different form. Step
response are useful for several reason:-
1- The step functions occur quite often in practice.
2- The response of a system to a sudden disturbance is
evaluated by step response.
3- The process of convolution can be defined in terms of step
signals and step response.
Fig (2.4) shows unit step function and step response.
u[n] fig(2.4a)
s[n] fig(2.4b)
7
EX 2.5 Find and sketch, the first four few sample value of the impulse response and
step responses of the system shown in fig (ex 2.5). Also determine the final value of
s[n] as n x(n) y(n)
+
Solution:-
0.8 (a)
T
By inspection we see that the recurrence formula is
[ ] = 0.8 [ 1] + [ ]
Its impulse response is therefore given by
[ ] = 0.8 [ 1] + [ ]
Evaluating h[n] term by term we
The step response equals the running sum of h[n].Hence its first few value are [using
the above results]
[4] = [3] + [4] = 3.3.616 and so on. The final value of s[n] forn
= 1+ + = <1
1
n 8 n
EX 2.6 Repeat Ex2.5 find the response to rectangular pulse input
with pulse duration n=4
Solution:-
We may find the response to the rectangular pulse by consider
x[n] as summation of a unit step starting at n=0 and an equal but
opposite step starting at n=4.
The output is found by superposition two step responses
[ ]= [ ] [ 4]
n 0 1 2 3 4 5 6
s[n] 1 1.8 2.44 2.952 3.362 3.689 3.951
-s[n-4] -1 -1.8 -2.4
y[n] 1 1.8 2.44 2.952 2.362 1.889 1.511
u[n]
y[n]
2.952
n
2.44 0
2.362 -u[n-4]
1.889
1.80 4 n
0
1.5
1 x[n]
n
n
0 4
9
2.4. correlation and convolution
Cross-Correlation function is a measure of similarities between
two signals.
[ ]= [ ] [ ]= [ ] [ ] ….. (2.6)
[ ]= [ ] [ ] … . (2.6 )
10
2) Linear convolution is used for aperiodic sequence and is given by
( )= ( ) ( ) …. (2.6 b)
[ ]= [ ] [ ] …. (2.9)
c) Distributive Property:- the distributive property of the convolution
operator state that
[ ] { [ ]+ [ ]} = [ ] [ ]+ [ ] [ ] .... (2.10)
Eq.(2.8) states that if two with impulse response [ ], [ ] are
connected in parallel an equivalent system is one that has a unit sample
response equal to the sum [ ] and [ ]
[ ]= [ ]+ [ ] …. (2.11)
Distributive property
h2[n]
fig (2.5) the interpretation of convolution properties from a system point view.
2.4.2 Performing Convolution
a) Direct Evaluation: when the sequences that are being convolved may
be described by simple closed form mathematical expression, the
convolution can be found by direct sum given in eq (2.1).
Ex 2.7 Let us perform the convolution of two signals
[ ]= [ ]= 0
0 <0
And h[n]=u[n]
Solution: u(k)
k
u[k-n]
n k
u[n-k]
n k
u[k]u[n-k]
n k
12
[ ]= [ ] [ ]= [ ] [ ]
= [ ] [ ]
Because u[k]=0 for k<0 and u[n-k] is equal to zero for k>n.
when n<0, there are no nonzero terms in the sum and y[n]=0.
On the other hand if 0
[ ]= =1+ + + + …+
1
[ ]=
1
Therefore [ ] = [ ]
13
c) Slide Rule Method
Slide rule method is convenient when both x[n] and h[n] are
finite in length and short in duration.
The steps involved in the slide rule method are as follows:-
1) Write the value of x[k] a long the top of a piece of paper
and the value of h[-k] a long the top of another piece of
paper as shown in fig (2.5a).
2) Line up the two sequence value x[0] and h[0], multiply
each pair of numbers and add the produce to find the value
of y[0].
3) Slide the paper with time reversed sequence h[k] to the
right by one, multiply each pair of numbers sum the
products to find the value of y[1], and repeat for all shift to
the right by n >0 . Do the same, shifting the time reversed
sequence to the left to find the value of y[n] for n<0.
… x[-2] x[-1] x[0] x[1] x[2] …
14
Ex 2.7Using the decomposition of x[n] into a set of weighted, shifted impulses, to
find the output of a digital processor with impulse response h[n] is given by
h[n]=0 for n<0 and n>2 , h[0]=1 , h[1]= -1, h[2]= 2
if the input signal is given by
x[n]=0 for n<-1 and n>2 , x[0]=2 , x[1]=3, x[2]= -1 and x[-1]=1
Solution:- [ ]= [ ] [ ]
x[n] 3 h[n] 2
2 1
1 n
n
n
-2 -1 0 1 2 -2 -1 0 1 2 3 4
x[- x[-1]h(n+1)
1 1 2
n n
-2 -1 0 1 2 -2 -1 1 2 3 4
1
2 x[0]h(n) 2
n
-2 -1 1 2 3 4 -2 -1 1 2 3 4
x[ -1) x[1]h(n-1) 6
3 3 n n
- -2) -3
1
n n
y[n] -1 7 -2
-1 1 3
15
n
Ex 2.8 Find the circular convolution between
[ ] = 1, 2, 3,4 0
[ ] = 4 ,3 ,2 ,1 0
Solution:- the type of the convolution which is used the circular since the
number of n is limited [for four value] and this means periodic
h[n] 4 3
[ ]= [ ] [ ] k=0 2
1
[ ]= [ ] [ ] n
4 2 k=-1 [lag]
h[n-k] 1 3
[0] = [ ] [ ]n n
[0] = [0] [0] + [1] [ 1] + [2] [ 2] + [3] [ 3]
[0] = 1 × 4 + 2 × 1 + 3 × 2 + 4 × 3 = 4 + 2 + 6 + 12 = 24
[1] = [ ] [1 ]
[2] = [ ] [2 ]
[3] = [ ] [3 ]
16
Ex2.9 Find the linear convolution between
[ ] = 1,2,3,4 0
[ ] = 4,3,2,1 0
Solution:- [ ]= [ ] [ ]
+ 1=2 1=2×4 1=7 = =4
[ ]= [ ] [ ]
[0] = [ ] [ ]
[1] = [ ] [1 ]
[4] = [ ] [4 ]
y[4]= [0] [4] + [1] [3] + [2] [2] + [3] [1] + [4] [0] +
[5] [ 1] + [6] [ 2] + [7] [ 3]
[4] = 1 × 0 + 2 × 1 + 3 × 2 + 4 × 3 + 0 = 20 .sinceh[n] is exist only
for n=0,1,2,3. In this case h[4]=h[5]=h[6]=h[7]=0
17
The Convolution Integral
If the input consists of a continuous of impulses the convolution
sum may be replaced by integral and become
( )= ( ) ( ) [ ]= [ ] [ ]
4) h(-
-
each of these stages
there is corresponding convolution integral.
18
Thus ( ) = ( ) ( )= ( ) ( ) [ ] 0 3
Thus ( ) ( ) exists in five stages:- [ ] 0 2
x(t) (a) h(t) x( ) (b) h( )
3 3
2 2
tt
3 2 3 2
h(t- h(t-
h(- 2 2
-2 -2 0 3
(c) (d) stage(1) overlap (e) stage(2a)
3 3 3
h(t- overlap h(t- overlap
2 2 2 h(t-
- -
(f) stage(2b) (g) stage(3) (h) stage(4)
3 x(t)
2 h(t-
(i)stage(5)
(a) Stage 1: t<0 and h(t-
( ) ( ) = 0 for all t
(b) Stage 2: 0 < 2 -
fig(e) and (f) y(t)
( )= ( ) ( ) 12
= 3×2 = 6[ ] = 6 0< 2
19
(c) Stage 3: 2 3 and there is complete overlap because x(t) and h(t- shown
in fig(g).
( )= 3×2 = [6 ] y(t)
= 12 2 3
2 3 t
(d) Stage 4: 3 5 this is another overlap as shown in fig(h) y(t)
( )= 3×2 = [6 ] 12
= 6(5 ) = 30 6
3 5 t
(e) Stage 5: t>5 as shown in fig(i) there is no overlap ( )=0
The convolution integral having a different expression for each of thethreeregion
corresponding to three stages as summarized below
0 2 y(t)=6t
2 3 y(t)=12
3 5 y(t)=30-6t
y(t)
12
10
8
6
4
2
0 1 2 3 5 t
20
2.6 Difference equation
There are many recursive and nonrecursive recurrence formulas to
describe the operation of digital processors in the time domain, and are
also referred to a difference equations. The general form of a difference
equation with three recursive and three nonrecursiveterms is given by
[ ]= [ 1] + [ 2] + [ 3] +
[ 1] + [ 1] + [ 2]… (2.11)
To make the equation even more general we allow an arbitrary number of
terms and rewrite eq (2.11) as follows
[ ]+ [ 1] + [ 2] +
= [ ]+ [ 1] + [ 2] + ….(2.11b)
Or
… (2.12)
The complexity of an LTI processor depends on
the number of terms on each side of equation.
The value of N which indicates the highest
order difference of the output signal is
generally referred to as the order of the system.
21
Frequency Domain Analysis
(Discrete Fourier Series and the Fourier Transform)
3. Frequency Domain Analysis
The Discrete Fourier Series and the Fourier Transform
3.1 Introduction
1
Let us consider a periodic digital signal x[n] as shown in
fig(3.1), such as
[ ] = [ + ]for all n
where N is the period of the sequence x[n].
The coefficients of its line spectrum indicate the amount of
various frequencies contained in the signal. They may fined by
the following equation
/
= [ ] …. (3.1)
Where represents the Kth spectral components or harmonic
N is the number of number of sample values in each
period of the signal
Eq(3.1) is known as the analysis equation of the discrete
time Fourier series (DTFS).
If we know the coefficient , we may represent x[n]
using the synthesis equation:
/
[ ]= …. (3.2)
Note: In some texts the1/N multiplier appears in the synthesis
equation rather than in the analysis equation and this is not an
important difference since it is a scaling factor.
one period Re ( ) Im ( )
3
2 2 2 2 2
1
n k k
-0.5
-1 --1
-2 -2
Fig(3.1)
(a)Periodic digital signal (b) Real parts of (c) Imaginary parts of
2
Ex(3.1)Determine the spectrum of the signals by using Fourier Series
a) [ ] = cos 2
b) [ ] = 1, 1, 0, 0 n>0
Solution
(a) 2 = 2 =
Since is not a rational number, the signal is not a rational
number, the signal is not periodic then the signal cannot expanded
in Fourier Series.
(b) = [ ] k=0, 1, 2, 3
= [ ]
1 /
= [ ]
4
1 1 1
= [ ] = [1 + 1 + 0 + 0] = < 0
4 4 2
1 ( ) 1
= [ ] = [ ]
4 4
1
= [0] + [1] + [2] + [3]
4
1 1
= 1+1 + 0 + 0 = [1 + ]
4 4 2 2
1 2
= [1 ]= <
4 4 4
In the same way fined =0 <0, = <
| |<
1/2
0 1 2 3 k k
/4
3
Ex(3.2)Sketch the periodic digital signal and find its Fourier
Coefficients and sketch their real and imaginary parts
[ ] = 1 + sin
+ 2 cos
4 4
Solution The values of x[n] are given in the table over one complete
period (n=0 to 7) as follows
n sin 2 cos x[n]
--------- ------------ ---------------- --------
0 0 2 3
1 0.707 0 1.707
2 1 -2 0
3 0.707 0 1.707
4 0 2 3
5 -0.707 0 0.293
6 -1 -2 -2
7 -0.707 0 0.293
The signal is drawn in fig (a)
x[n] can be expressed as a sum of impulses
[ ] = 3 + 1.707 ( 1) + 0 ( 2) + 1.707 ( 3) + 3 ( 4)
+ 0.293 ( 5) 2 ( 6) + 0.293 ( 7)
The Fourier coefficients are
= 0, = 1, = , = 1, = /2, = 1, =0
2
x[n]
3 3
1.707 1.707
0.293 0.293
0 1 2 3 4 5 6 7 n
-2
R( ) I[ ]
1 0.5
k12
12 k
-2 -11 1 2 -2 -0.5
4
3.3 Power and Energy of periodic signal
Parceval's theorem can be used to calculate the total power or
energy of a signal in the time and frequency domains. In the
case of a real, periodic digital signal, the theorem takes the form
| [ ]| = | | … (3.3)
The average power of discrete- time periodic signal with period
N is defined as:
… (3.4)
[ ] / /
= since [ ] =
1
= ( [ ] )
= = | |
… (3.5)
5
3.4 Properties of the Fourier Series
In the following discussion we use a double headed arrow to denote the
relationship between a signal and its spectrum. Thus x[n]
indicates that the periodic digital signal x[n] has spectral coefficients .
6
6) Modulation property of the discrete Fourier Series:
[ ] and [ ]
then
…. (3.11)
3.5 The Fourier Transform of Aperiodic Digital Sequences
Most practical digital signals are aperiodic (e.x digital signals in
communication, heartbeat, variation of temperature, …)
A common approach to develop the Fourier transform for a digital
sequence via the continuous time Fourier Transform. However,
since our course is DSP, we prefer a digital approach, which is
based on the discrete Fourier Series equation and modify then
The analysis equation of the discrete Fourier Series, defined by
/ ….. (3.12)
Eq(3.12) is used for periodic sequences with period between n=0 to N-1.
7
What happens to the spectral coefficients if we stretch the signal in
this way:-
(a) Coefficient of become smaller because of the 1/N multiplier in
equation (3.12).
(b) Coefficient of becomes closer in frequency because N also appears
in the denominator of the exponential.
, the various harmonics therefore bunch together
and have vanishingly small amplitudes, the product remained finite.
one periodic
x[n] 5 sample x[n] one periodic 12 samples
n n
Thus X
Using similar produce, we can derive the inverse transform
of X
[ ]= ( ) …. (3.14)
Eq. (3.13) is an analysis equation (Fourier Transform of
aperiodic digital sequence).
Eq. (3.14) show how x[n] can be synthesized (i.e. inverse
of Fourier transform of aperiodic digital sequence).
8
Ex(3.3)Fined the Fourier transforms of aperiodic digital signal shown in
fig below. Sketch their magnitude over the range - and
discuss the result.
Solutionx(n)
[ ]= [ ] x[n]
where =
0.2 n
- - 0
( ) = 0.2{ [ 2] + [ 1] + [ ] + [ + 1] + [ + 2]}
Using the shifting property of the unit impulse
( ) = 0.2{ + +1+ + }
= 0.2(1 + 2 +2 2 )
o The spectrum is real since x[n] is an even function. It is sketched in
the lower part of fig.
o
Solution x[n]
( )= [ ] 0.5
0.25
0.125 n
-22 -1
1 0 1 2 3 4
9
( ) = 0.5 = if a <1
.
2
+….]
.
if a=e-
0.5
| ( )| = /
[(1 0.5 ) + (0.5 ) ]
0.5
= /
[1 + 0.25 + 0.25 ]
]
1
1/3
0
Note that:-
1- If = 0, | ( )| = 1 and is max.
2- If = , | ( )| = and is min.
3- X( )
3.6 Properties of Fourier Transfers of the aperiodic digital
1) Linearity: If [ ] ( ) and [ ] ( )
Then
Then
3) Convolution: If [ ] ( ) , [ ] ( )
Then 1 [ ] 2( ) 1[ ] × 2( )
10
3.7Frequency Response of LTI Processors
3.7.1 The first method by using input signal frequency response and LTI
frequency response
In general we -
( )
… (3.15)
( )
Also … (3.15)
[ ( ) ( )]
( ) ( ) = | ( )|| ( )| …(3.17)
11
Ex(3.5) The filter – impulse response is given by
[ ] = 0.2{ [ 2] + [ 1] + [ ] + [ + 1] + [ + 2]}
Find the frequency response
Solution:
( ) is the frequency response given by
( )= [ ]
( ) = 0.2(1 + 2 +2 2 )
Ex(3.6) The filter – impulse response is given by
[ ] = 0.5 [ ] + 0.25 [ 1] + 0.125 [ 2] +
Find the frequency response
Solution
( )= [ ] [See Ex3.4]
12
3.7.2LTI Systems Characterized by Linear Constant Coefficients
Difference Equation (LCCDE) [2nd method to fined frequency response]
[ ]= [ ]…. (3.20)
The integer N is called the order of the DE or the order of the
system.
13
Ex(3.7)Fig(a) shows a high pass filter. Fined its frequency response
.
[ ] = 0.8 [ 1] + [ ] [ 1]
[ ] + 0.8 [ 1] = [ ] [ 1]
Compare y[n] with general D.E form
[ ]= [ ]…. (1)
= 1‚ = 0.8‚ = 1‚ = 1
But the F.T for eq(1) is given by
( ) = ( )
1 + ( 1) 1 1
= =
1 + (0.8) 1 + 0.8
1 +
=
1 0.8 + 0.8
Note F.T for both sides of eq(1) is given by
[ ] = [ ]
14
3.7.3 Solution of Linear Constant Coefficient Difference Equation
(LCCDE). (Third method to find frequency response)
LCCDE describe the relationship between the input-output
of LTI system. The object of the solution is to determine
an expression to describe the output y[n] of LTI.
There are two method for this solution:-
1) Direct method.
2) Indirect method based on Z-transform.
The direct solution assumes that the total solution is the
sum of the two parts
... (3.21)
15
3.8The Z-transform and its applications in signal processing [Fourth
method to find frequency response]
A discrete signal has values which are defined only at discrete value of
time. As discussed in previous such a continuous time signal at regular
time intervals nT, n=0, 1, … where T is the sampling period. The discrete
time signal is represented as a sequence of numbers:-
[ ]= = 0‚1‚ …
[ ]= = 0‚1‚ …
= = 0‚1‚ …
Where the symbol, [ ], [ ], or indicated the value of the signal at
the discrete time n or (nT).
3.8.1 The Z-transform
The Z-transform of a sequence, x[n], which is valid for all n, is
defined as
( )= [ ] …. (3.22)
…. (3.23)
16
There are three main reasons for covering the z-transform
1) It offers an extremely compact and convenient notation to
description digital signals and systems.
2) Pole-Zero description of a processor is a great help in
visualizing its stability and frequency, response characteristics.
3) It is widely used by DSP designers.
The region of convergence (ROC) of a finite duration signal is the
entire z-plane, except the poi
excluded, because ( > 0)
( > 0) becomes unbounded for z=0.
Ex(3.8) Findthe z-transform and the region of converges for the discrete
time sequence given in fig(3.8)
Solutionx[n]
5
3 3
1 1
0
-6 -5 -4 -3 -2 -1 0 1 2 3 4 n
The sequence of the signal is noncausal, since is not zero for n<0
but it is of a finite duration.
The sequence has value x(-6)=0, x(-5), x(-3)=5, x(-2)=3, x(-1)=1
and x(0)=0.
( )= [ ] = +3 +5 +3 +
17
Ex(3.9) Fined the z-transform and the region of convergence for the
discrete time sequences
Solution
( )= [ ]
( )= +3 +5+3 +
Ex(3.10) Fined the z-transform and the region of convergence for the
discrete time sequence defined by
[ ]=1 0
=0 <0
Solution The sequence is a causal sequence of infinite duration
( )= [ ]
( )=
( )=1+ + + +
The series is convergence if | | < 1 or equivalently if | | > 1. Thus
we may express X(z) in closed form if | | > 1.
1
( )= =
1 1
- In this case, the z-transform is valid everywhere outside a circle of
unit radius whose center is at the region.
18
( )=
1
- The outside of the circle is the region of convergence.
- We can readily that Im
when | | > 1, X(z) coverage.
where | | < 1, X(z) diverges.
For ex. If z=2 (outside the circle) | | = 1 Re
( )=1+ + + +
= region of convergence
1 1 1
( )= 1+ +( ) +( ) +
2 2 2
= =2 thus X(z) converges
If = (inside the circle)
1 1 1
( )=1+ +( ) +( ) +
0.5 0.5 0.5
= 1+2+4+8+… thus X(z) diverge
3.8.2 The Inverse Z-transform
- The inverse z-transform (IZT) allows recovering the discrete time
sequence, x[n], given its transform. The IZT is particularly useful in
DSP, for example in finding the impulse response of digital filters.
The inverse z-transform is defend as
[ ]= { ( )} …. (3.24)
( )= [ ]
19
Practice, X(z) is often expressed as a ratio of two polynomials in
( )= …. (3.26)
In this form the inverse-z transform, x[n] can be obtained using one of
several methods:-
1) Power series expansion method
2) Partial fraction expansion method
3) Residue
+ + + +
( )=
+ + + +
1+2 +
( )=
1 + 0.356
Solution In this method, the numerator and denominator of X(z) are first
expressed in either descending powers of Z or as ending power of Z and
the quotient is then obtained by long division
20
1+3 + 3.6439 + 2.5756 +
1+ + 0.3561 1+2 +
1± 0.3561
3 + 0.6439
3 ±3 1.0683
3.6439 1.0683
2.5756 1.2975927
2.5756 3 1.2975927 4
1+2 + +2 +1
( )= =
1 + 0.356156 + 0.3561
21
Partial Fraction
+ + + +
( )=
+ + + +
If poles of X(z) are first order and N=M , then X(z) can be expanded as
( )= + + + +
1 1 1
= + + + +
… (3.27)
Where are the poles of X(z), are the partial fraction coefficients
and
…. (3.28)
22
3.8.2.2 Partial fraction expansion method
In this method, the z-transform is first expanded into a sum of simple
partial fractions. The inverse z-transform of each partial fraction is
obtained from table 3 and then summed to give the overall inverse
z-transform.
Ex(3.12) Find the inverse z-transform of the following
( )=
1 0.25 + 0.375
Solution: - for simplicity, we first express the z-transform in positive
power of z. multiply X(z) by .
( )= =( … (1)
. . . )( . )
( . )( . )
= .
+ .
= ( )…. (2)
23
( )= + … (2)
. .
( . )
.
= where =
( . )
.
= where = 5
The desired inverse z-transform, x[n] is the sum of the two inverse
z-transform
4 4
[ ]= (0.75) ( 0.5)
5 5
Ex(3.12) Find the discrete time signal, x[n], represented by the following
z-transform using the partial fraction expansion method
1+2 +
( )=
1 + 0.3516
+2 +1
( )=
+ 0.3561
The poles of X(z) are found by solving
+ 0.3561 = 0
24
Using the formula
2
+ 0.3561 = 0
1 + (1 4 × 0.3561)
= = 0.5 + 0.3257 =
2
1 (1 4 × 0.3561)
= = 0.5 0.3257 =
2
Where r=0.5967 and = 33.08
+2 +1
( )= = + +
( )( )
Using the procedure of EX. (3.12) to find
1
= = = 2.8082
0.356
= 6.06066 < 98.58
= 6.06066 < 98.58 =
( ) = 2.8082 + +
1) Linearity
If [ ] ( )
[ ] ( )
Then [ ]+ [ ] ( )+ ( ) … (3.29)
2) Delay or shift
If [ ] ( )
[ ] ( )… (3.30)
3) Convolution: Given a discrete LTI system with input, x[n], and
impulse response, h(k), the output of the system is given by
[ ]= [ ] [ ]
4) Time reversal
[ ] ( )
[ ] ( )
5) Differentiation or multiplication by n
If [ ] ( )
Then the z-transform of nx[n] can obtained by differentiating X(z)
( )
[ ]
26
3.8.4 Pole-Zero description of discrete –time system
( )
( )= = … (3.32)
( )
Where is the ith zero, is the ith pole and K is the gain factor.
Fig(3.4)
27
Ex(3.12) Plot the z-plane poles and zeros of the following z-transform
( 1.2)( + 1)
H(z) =
( 0.5 + 0.5)( 0.5 0.5)( 0.8)
Solution: Im
= [ + ]wherecis(x)=cos(x)+jsin(x)
If z= r cos [compare Z= r cos with z5-1=0 z5=1]
in this case r=1 , =0 K=0,1,2,3,4 i.e k=[0,1, …. , n-1]
2 2
= 0+ = 1 = 1 [ 72 ]
5
= 1 [0] = + jsin = 1
= 1 [72] = 72 + jsin72 = 0.3 + j0.9
= 1 [2 × 72] = 144 + jsin144 = 0.8 + j0.58
= 1 [3 × 72] = 216 + jsin216 = 0.8 j0.58
= 0.3 j0.5
Im
Re
28
3.8.5 Frequency response estimation
- The frequency response of a system can be obtained from its z-
transform. If we set = , we obtain the Fourier transform of
the system
( )= [ ] | …. (3.34)
= ( )= [ ] … (3.35)
- H( ) is referred to as the frequency response of the system.
- Eq(3.35) shows the dependence of the frequency response on the
sampling frequency.
- In the design of digital filter. It is necessary examine the spectrum
of the filter in order to ensure that the desired specifications are
satisfied.
- The frequency response may be obtained from the z-transform
using several methods.
29
( )
=
( )
…. (3.31)
Eq(3.31) with two zero and two poles is shown in fig (3.5). In this case,
the frequency response for a given point = = is given by
=
( )( )
= …. (3.32)
- Thus the magnitude and phase responses for the system, from eq 3.32
= =1 < = + ( + ) (3.32a)
Im
P
Re
30
Ex3.16 Determine the frequency response at dc, 1/8, 1/4, 3/8, 1/2 the
sampling frequency of the causal discrete time system has the following
z-transform
+1
( )=
0.7071
Sketch, the amplitude frequency response in the interval 0 < ,
where (rad/s) in the sampling frequency.Using the geometric method.
Solution using eq(3.32) Im
( )= P
( )
1- At dc wT=0 Re
1+1+0
= = 6.828 < 0
1 0.707 + 0
As shown in fig(a)
2- At = /8, = = =
= Re
.
. .
= = 2.6131 < 67.5
.
31
ie. responses at remaining frequency, obtained in a similar way, are
summarized below.
Im Im
P
P Re P Re
(e) \8 \4 3 \8 \2 w
< ( ) (2) The magnitude response | ( )|
60 is symmetrical about half the sampling
40 frequency (Nyquist frequency)
20 (3) The phase response antisymmetrical
A bout the same frequency
(f) \8 \4 3 \8 \2 w
-20
-40
-60
-80
-100
32
3.8.5.2 Direct Computer evaluation of frequency response
Geometric evaluation of the frequency response is simple and
gives one basic information for the frequency response. But it is
clearly very complex if the precise response is required at many
frequencies.
3.8.5.3 Frequency response estimation via FFT
FFT may also be used to evaluate the frequency response of
discrete time systems.
In this case firstly, fined the impulse response and then to
compute the FFT of the impulse response.
C-Language is used to implement FFT with smooth frequency
response.
3.8.6 Stability Consideration
- Stability analysis is often carried out as part of the design of
discrete-time systems.
- A useful stability criterion for LTI systems is that all
bounded inputs produce bounded outputs. This is also called
BIBO (bounded input, bounded output) condition.
1) An LTI system is said to be BIBO state if and only if its
satisfies condition
… (3.33)
Where h(n) is the impulse response of the system
33
2) When a poles lies inside the unit circle the system is stable.
3) When a poles lies on or outside the unit circle the system is unstable.
Note when a pole is coincident with a zero on the unit circle so that its effects
are nullified.
- Since stability to the radius of z-plane poles, it is often helpful to express
their locations in polar co-ordinates.
- Let us consider a processor with complex conjugate pole-pair as shown in
fig(3.6). The poles are at radius (r) and make angle with the positive
real axes. These location are therefore
= ( )and= ( ).
( ) 1
( )= =
( ) ( )( )
( ) 1
=
( ) [ (cos + sin )][ (cos sin )]
1
=
2 cos +
Im
Re
Fig(3.6)
Or
( )[ 2 cos + ]= [ ]
4.1 DFT
1
- The DFT of x[nT] is then defined as the sequence of complex value
( ) = (0). ( ). (2 ). … . ( 1) in the frequency domain,
and | ( )| = ( )+ ( )
( )
and X(k) has a phase angle = ( )
… (4.2)
- Note that N real data value (in the time domain) transform to N complex
DFT value (in the frequency domain). The value of DFT are given by
( )= [ ] = [ ] ..(4.3)
Where k= 0, 1, 2, 3, … N-1
[ ] = ( ). =2 / . = =
- The relationship between DFT and Fourier transform is given by
2
Solution The data represents four consecutive voltage x[0]=1, x[T]=0,
x[2T]=0, x[3T]=1, recorded at time intervals T. Thus N=4. It is required
-1=3]. Using
eq(4.3).
( )= [ ] where k=0,1,2,3
If k=0,
(0) = [ ] =
= [0] + [ ] + [2 ] + [3 ] = 1 + 0 + 0 + 1 = 2
Thus X(0)=2 is real value of magnitude 2V and (0)=0.
If k=1,
( )
(1 ) = [ ] =
2 3
=1+0+0+ 4 (1)(3) =1+ 2
2 2
= 1 + cos( ) sin = 1+
3 3
2V and phase angle
2
(1 )= 1 = 45 , = .
If k=2,
( )
(2 ) = [ ] =
2
=1+0+0+ 4 (2)(3) =1+ 3
=1 1=0
(2 )=0.
If k=3,
( )
(3 ) = [ ] =
9
=1+0+0+ 2 =1
-j is complex with magnitude 2V and phase angle
-45 .
3
Thus the time series [1, 0, 0,1] has the DFT given by the sequence
[2,1+j,0,1-j]. x[nT] (a)
To fined = 1 1 =
×
= 125
Solution the
( )= [ ]
( )
( + ) = [ ] = [ ]
= [ ] = ( ) Since =1
4
4.2 Inverse Discrete Fourier Transform IDFT
IDFT is used to carry out discrete transformation from the frequency to
the time domain. IDFT is given, IDFT is defined by
[ ]= ( ) …. (4.4)
1
= ( )
[ ]= ( ) … (4.5)
E.x 4.3 Calculate the IDFT from its DFT components [2, 1+j, 0, 1-j]
Solution [ ]= ( )
For n=1, [ ]= [ ]= ( )
1
= ( )
4
1
2 + (1 + )
= + 0 + (1 )
4
1
= [ 2 + (1 + ) + (1 )( )] = 0
4
For =2 [2 ] = 0
For =3 [3 ] = 1
5
4.3 Properties of the DFT
1) Symmetry
[ ( )] = [ ( )] … (4.6)
[ ( )] = [ ( )] … (4.7)
Where denote the real part states the symmetry of the amplitude
spectrum.
denote the imaginary part states the antisymmetrical of the phase
spectrum.
2) Perceval's theorem: The normalized energy in the signal is given by
either of the expressions
[ ]= | ( )| … (4.8)
The right hand side of eq(4.8) is the mean square spectral amplitude,
while the left hand side is the sum of the squared magnitude of the time
series.
3) Delta Function
[ ( )] = 1 …. (4.9)
Where is the Discrete Fourier Transform
4) Convolution
(a) Time Convolution
[ ]= [ ] [ ]= [ ( ) ( )] … (4.10)
Where denote circular convolution, and [ ], [ ]and [ ] are finite
sequence of equal length.
Further more ( )= ( ) ( ) … (4.11)
Where ( )= [ [ ]] … (4.12)
(b) Frequency Convolution
( ) ( )= [ [ ] [ ]] …. (4.13)
Where ( ) ( )= ( ) ( ) …. (4.14)
6
4.4 Computational complexity of the DFT
- A large number of the multiplication and addition are required for the
calculation of the DFT.
- For an 8 point
( )= /
[ ] where k=0,1,2,…,7
Eq(4.15) contains eight terms on the right hand side. Each term consists
(8) complex multiplications and seven complex addition to be calculated.
For an 8 point DFT required 8 = 64 complex multiplication
8 × 7 = 56 complex addition
7
The N-point DFT of an N-point sequence x[n] requires complex
multiplication and complex addition [N(N-1) complex addition exactly].
( ) [ ] = [ ] … (4.15)
= = = =
( ) / ( )( )
= =
= =
= … (4.16a)
= / …. (4.16b)
( )
= …. (4.16c)
8
4.5 Decimation in Time FFT
[ ] = [2 ] = 0. 1. 2. … . 1
2
an the second sequence, h[n] is formed from, the odd index
[ ] = [2 + 1] = 0.1.2. … . 1
2
In terms of these sequence the N-point DFT of x[n] is
( )= /
[ ] =
x[n] fig(4.1)
-2 -1 0 x[1] 2 3 4 5 x[6] 7 k
( )= [ ] + [ ] …. (4.17a)
( )
( )= () + () …. (4.17b)
( )
Because = / = = / = /
( )= () / + () / … (4.18)
Note that the first term is the N/2 point DFT of g(n) and the second is the N/2 point
DFT of h(n)
( )
= = / = /
( )= ( )+ ( ) … (4.19)
9
Although the N/2 point DFT's of g[n] and h[n] are sequences of length
N/2, the periodicity of the complex exponentials allows us to write:-
( )= ( + ) …. (4.20a) ( )= ( + ) … (4.20b)
Therefore, X(k) may be computed from the N/2 point DFT's G(k) and
H(k) because
/ /
= = … (4.21a)
+ = ( ) …. (4.21b)
Fig(4.2) shows the block diagram of the computations that are necessary
for the first stage of 8 point DIT-FFT.
Using Eq(4.19) and eq(4.20) to draw fig (4.2) where G(k)=DFT of g( )
( )= ( )+ ( ) … (4.19) H(k)=DFTof h( )
Fig(4.2)
x(0) X(0)
4-point
x(2) X(1)
DFT
x(4) X(2)
x(6) X(3)
x(1) X(4)
4-point
x(3) DFT X(5)
x(5) X(6)
x(7) X(7)
( )= [ ] / = [ ] / + [ ] / … (4.22)
As before G(k) can be simplified to
( )= [2 ] / + / [2 + 1] / ….. (4.23)
10
( )= [2 ] / + / [2 + 1] / ….. (4.23)
Where the first term is the N/4 point DFT of the even samples of g[n] and
the second term is the N/4 point DFT of the odd sample
Fig (4.3) shows the decimation of 4 point DFT into two point DFT's in
the decimation in time FFT.
Fig(4.3)
x(0) 2 point G(0)
x(4) DFT G(1)
x(2) 2 point
G(2)
x(6) DFT
G(3)
Fig(4.4)
q[0] Q(0)=q(0)+q(1)
q[1] Q(0)=q(0)-q(1)
- The basic computational unit of the FFT, shown in fig(4.5a) is called
butterfly. This structure may be simplified by factoring out a term
from the lower branch as shown in fig (4.5b). the factor remain is
/
= 1.
Fig(4.5)
/
-1
a) The butterfly which is the basic computational element of the FFT
algorithm.
b) A simplified butterfly, with only one complex multiplication.
11
Computing an N-point DFT using a radix-2 decimation in time FFT is
much more efficient then calculating the DFT directly. For example if
= 2 , there are log = stages of computation. Because each
requires N/2 complex multiplication by the twiddle factors and N
complex addition, these are a total of complex multiplications
and complex addition. Thus big saving in time for execution the
DFT by using FFT.
A Complete 8-point radix-2 decimation in time FFT is shown in fig (4.6)
12
Pass1 pass2 G1 pass3
x[0] X(0)
W 2
x[4] X(1)
-1
G3
x[2] X(2)
W 4
x[6] X(3)
-1
W
x[1] X(4)
-1 H0 -1
W W
x[5] X(5)
-1 -1 H1 -1
W
x[3] X(6)
-1 H2 -1
W W
x[7] X(7)
-1 -1 H3 -1
fig (4.6) A complete eight point radix-2 decimation in time FFT
4.7 Decimation in Frequency FFT
Another class of FFT algorithms may be derived by decimating the output sequence
X(k) into smaller and smaller subsequences. These algorithm are called decimation in
13
frequency FFT may be derives as follows: Let N be a power of 2(Radix2)N=2 and
consider separately evaluating the even and odd index samples of X(k).
The even samples are
(2 ) = [ ] … (4.24)
Separating this sum into the first N/2 points and the last N/2 points
/
(2 ) = [ ] / + / [ ] / … (4.25)
Because = /
( )
Finally because /
= /
/
(2 + 1) = [ [ ] + ] / … (4.26)
Which is the N/2 point DFT of the sequence that is formed by adding the first N/2
points of x[n] to the last N/2.
Using the same procedure for the odd sample of X(k) we have
/
(2 + 1) = [ [ ] + ] / … (4.27)
Fig (4.7) an eight point decimation in frequency FFT of the first stage
x[0] X(0)
x[3] X(6)
W
x[4] X(1)
-1 W
x[5]
4-point X(3)
-1 W
x[6] DFT X(5)
-1 W
x[7] X(7)
-1
14
Ex.4.4 Calculate the FFT of the data sequence (1,0,0,1) and plot the
amplitude and phase spectra if the decimation in time is used.
Solution fig(4.4) Flow graph of the FFT
x[0] G(0) X(0)
=1 0 + cos sin [0 1]
2 2
(1) = 1 0 + [0 ][ 1] = 1 +
(2) = (0) (0) = (0) (0)
(2) = [0] + [2] [1] + [3] = 1 + 0 0 1=0
16
A framework for digital filter design
A framework for digital filter design
- The framework provided to the designer valuable information from
specifications to implementation.
5.1 Structures for the Realization of Linear Time Invariant (LTI) System.
- Let us consider the first order system is given by
[ ]= [ 1] + [ ]+ [ 1] … (5.1)
Which is realized as in fig (5.1a).
- This realization uses separate delays (memory) for both the input and
output signals samples and it is called a direct form I structure.
- This system can be viewed as two LTI systems in cascade. The first is
nonrecursive system described by
[ ]= [ ]+ [ 1] … (5.2)
- The second is a recursive system described by
[ ]= [ 1] + [ ] … (5.3)
Fig (5.1)
x[n] v[n] y[n] x[n] w[n] y[n]
+ + + +
(a) (b)
w(n-1) (c)
- As we have seen the main properties of the LTI system are the
association and commutation as shown in fig (5.2).
x[n] y[n] h[n] y[n] x[n] x[n] y[n]
h[n] x[n] [n] [n]
y[n]
commutation association
- If we interchange the order of the cascaded LTI system, the overall
response remains the same due to the association property. Thus of
we change the order of the recursive and nonrecursive system, we
obtain another structure.
1
For the realization of the system described by(5.1). The resulting system
is shown in fig (5.1b). From this figure we obtained the two difference
equations.
[ ]= [ 1] + [ ] … (5.4)
[ ]= [ ]+ [ 1] … (5.5)
- Thus the two difference eq(5.4) and (5.5) are equivalent to single
difference equation (5.1).
- Thus new realization shown in fig (5.1c) required only one delay for
w[n] and hence it is more efficient in terms of memory requirements.
It is called the direct from II structure.
- These structures can be generalized for the general LTI recursive
system described by the difference equation
[ ]= [ ]+ [ ]… (5.6)
- Fig (5.2) shows the direct form I structure for this system. This
structure requires M+N delays and N+M+1 multiplication.
- Using the previous steps to define the nonrecursive system by
… (5.7)
… (5.8)
2
By reversing the order of these two systems, as was previously done for
the first order system, we obtain the direct form II structure shown in fig
(5.3). This structure is the cascade of a recursive system
[ ]= ( ) + [ ] … (5.9)
[ ]= ( ) … (5.10)
+ + + +
+ +
+ +
3
- Linear time- invariant systems described by a second order difference
equation are an important subclass of the more general systems
described by eq(5.6)
[ ]= [ ]+ [ ] … (5.6)
- The second order systems are usually used as basic building blooks
for realizing higher order systems.
- The most general second order system is described by the difference
equation, with N=M=2, eq[5.6] becomes
[ ]= [ 1] [ 2] + [ ]+ [ 1] +
[ 2] …. (5.11)
- The direct form II structure for realizing this system is shown in fig
(5.4a). If we set = = 0 then reduced to
[ ]= [ ]+ [ 1] + [ 2] …. (5.12)
Eq(5.12) represents special case of FIR system.
- If we set = = 0 , we obtain purely recursive second order
system described by difference equation
[ ]= [ 1] [ 2] + [ ] …. (5.13)
- Eq (5.12) and (5.13) are shown in fig (5.4b) and fig (5.4c).
b2 y[n]
+ + + +
(b)
x[n] y[n]
+ +
(a)
(c)
Fig (5.4) structure for the realization of second order systems for
(a) General second order
(b) FIR system
(c) Purely recursive system
4
The notation that is used for these elements [adders, multipliers and
delay] which are used to implement the digital network as shown in
fig(5.5). A network is also represented by a signal flowgraph, which is a
network of directed branches that are connected at nodes. Each branch
has an input and output with direction indicated by an arrowhead. The
nodes in a flowgraph correspond to either adders or branch points.
Finally, there are two special type of nodes:-
1) Source nodes: These are nodes that have no incoming branches and
are used for sequences that are input to the filter.
2) Sink nodes: These are nodes that have only entering branches and are
used to represent output sequence.
Fig (5.5)
[ ] [ ]
(d) Signal flowgraph consisting of nodes, branches, and node variable.
Node j represents adder and Node k is a branch node.
Ex 5.1 Draw the block diagram and signal flowgraph for the first order
discrete system described by the difference equation
[ ]= [ ]+ [ 1] + [ 1]
Solution
Block diagram
Using the same procedure in fig (5.1)
5
5.2 Introduction to digital filter
- A filter is essentially a system or network that selectively changes the
wave shape, amplitude and or phase-frequency characteristics of
a signal in a desired manner.
- Common filtering objectives are to improve the quality of a signal ….
(to remove or reduce noise), to extract information from signals or to
separate two or more signals previously combined to make, for
example, efficient use of an a available communication channel.
- A digital filter is a mathematical algorithm implemented in hardware
and /or software that operate on a digital input signal to produce a
digital output signal of achieving a filter objective.
- A simplified block diagram of a real time digital filter with analogue
input and output signals is shown in fig (5.6).
Fig (5.6)
input x[n] y[n] y(t)
Input ADC Digital DAC Output
x(t) filter process
filter
Analogue input Analogue o/p
Advantage of Digital filters:-
1) Digital filter have truly linear phase response.
2) The performance of digital filter does not vary with environment
(thermal variation)
3) The frequency response of a digital filtered can be adjusted if it is
implemented using a programmable processor.
4) Several input signals or channels can be filtered by one digital filter
without the need to change the hardware.
5) Both filtered and unfiltered data can be saved for further use.
6) High precision achieved by digital filter and depend on word length.
7) The performance of digital filter is repeatable from unit to unit.
8) Digital filter is very wide also can be used for low frequency.
6
Limitation of digital filter
Fig (5.7)
h(k), k=0,1,2
x[n] y[n]
Impulse response
- For IIR filters, the impulse response is finite duration whereas for FIR
it is of finite duration, since h(k) for FIR has only N values. In practice
it is not feasible to compute the output of the IIR filter using Equation
(5.14) because the length of its impulse response to long (infinite in
theory). Instead, the IIR filtering eq(5,14) is expressed in a recursive
form.
7
[ ]= ( ) ( )
= [ ] [ ] … (5.16)
Where and are the coefficients of the filter.
- Alternative representations for the FIR and IIR filters are given in
equation (5.17a) and (5.17b). These are the transfer functions for these
filters are very useful in evaluating their frequency responses
( )= ( ) … (5.17a) FIR
( )= … (5.17b) IIR
The choice between FIR and IIR filters depends on the relative advantages
of the two filters
1) FIR has linear phase response and this is important for data transition,
biomedicine, digital audio and image processing. However, the phase
responses of IIR filters are nonlinear.
2) FIR filters realized nonrecursively are always stable. The stability of
IIR cannot always be guranted, since IIR filters realized recursively.
3) FIR requires more coefficients for sharp cutoff than IIR. Thus for a
given amplitude response specification, more processing time and
storage will be required for FIR implantation.
4) Analogue filters can be readily transformed into equivalent IIR digital
filters meeting similar specifications. This is not possible with FIR
filters as they have no analogue counterpart. However, with FIR it is
easier to synthesize filters of arbitrary frequency responses.
8
5) In general, FIR is algebraically more difficult to synthesize, if CAD
support is not available.
- From the above, a broad guideline on when to use FIR and IIR would
be as follows:-
a) Use IIR when the only important requirements are sharp cutoff
filters and high through put.
b) Use FIR, if number of filter coefficients is not too large and if little
or no phase distortion is desired.
Note Newer DSP processors have architectures that are tailored to FIR
filtering, and some are designed specifically for FIR.
1) [ ] = [ 1] [ 2] + [ ]+ [ 1] +
[ 2]
2) [ ] = [ ]
9
The corresponding set of difference equations for M=N=2
[ ]= [ ] [ 1] [ 2] … (5.9)
[ ]= [ ]+ [ 1] + [ 2] … (5.10)
y[n]=-a 1 y[n-1]-a 2 y[n-2]+b 0 [x]+b 1 x[n-1]+b 2 x[n-2] … (5.11)
Note: see fig(5.1), fig(5.4a)
x[n] w[n] y[n]
+ +
(1) (IIR)
+ +
+
y[n] (2) (FIR)
1) Filters (1) and (2) are IIR and FIR respectively.
2) The block diagrams are shown in figs (1) and (2).
3) From examination of the two difference equations and storage requirements
for both filters are summarized below.
FIR IIR
Number of multiplication 12 5
Number of addition 11 4
Storage locations (coeffients and data) 24 8
It is clear that IIR filter is more economical in both computational and storage
requirements than FIR.
10
5.4 Filter design steps
The design of a digital filter involves five steps:-
1) Specification of the filter requirements.
2) Calculation of suitable filter coefficients.
3) Representation of the filter by suitable structure (realization).
4) Analysis of the effects of finite wordlength on filter performance.
5) Implementation of filter in software and/or hardware.
The five steps are not necessarily, independent, nor are they always
performed in the order given.
= passband deviation. …
= stopband deviation. F s /2
= passband edge frequency.
= stopband edge frequency. Pass band transition band stopband
f norm
- The edge frequencies are often given in normalized form, that is as
a fraction of the sampling frequency ( / ).
- Passband and stopband deviations may be expressed as ordinary
numbera are in decibels when they specify the passband ripple and
minimum stopband attenuation respectively
( ) = 20 …. (5.18a)
( ) = 20log (1 + ) …. (5.18b)
11
Ex 5.3 An FIR bandpass filter is to be designed to meet the following
frequency response specifications:-
passband = 0.18-0.33 (normalized)
Trainsition width = 0.04 (normalized)
Stopband deviation= 0.001
passband deviation= 0.005
1) Sketch the tolerance scheme for the filter
2) Express the filter band edge frequencies in the standard unite of
kilohertz, assuming a sampling frequency of 10kHz and the
stopband and passband deviation in decibels.
Solution (1) The tolerance scheme for the filter is given in fig (5.3)
(2) The band edge frequency at a sampling frequency of 10kHz and the
stopband and passband deviation are given below:-
12
3. Representation of a filter by a suitable structure (Realization)
+ + H(z)=
[ ]= [ ]
4
=1 [ ]
+ +
13
x[n] ( ) [ ] ( ) y[n]
+ + + +
+ + + +
( )= +
+
x[n] [ ] [ ] y[n]
+ + +
[ ]= [ ] [ ] [ 2]
[ ]= [ ] [ ] [ 2]
[ ]= [ ]+ [ 1]
+ [ ]= [ ]+ [ 2]
[ ]= [ ]
[ ]
C [ ]= [ ]+ [ ]+ [ ]
14
2. For FIR filter three structure are used:-
(1) Direct form (or transversal) (2) Frequency sampling
(3)Fast convolution.
a. For most widely used structure for FIR is the direct form as shown in fig
(5.5a) because it is simple to implement. In this form, the FIR is
sometimes called a tapped delay line as transferal.
Fig (5.5a) Direct (Transversal) realization
x[n]
+
y[n]
[ ]= [ ]
( )=
-1
+ H(2) y[n]
+
H(N-1)
+
15
c. Fast convolution realization: The fast convolution realization uses the
computational advantage of the Fast Fourier Transform (FFT) and is
particularly attractive in situations where the power spectrum of the signal
is required. Fig (5.5c) shows the fast convolution.
d. There are many other practical structures for digital filters, but most of
these are popular only in specific application areas. An example is the
lattice structure which finds use in speech and linear predication
application. The lattice structure may be used to represent FIR and IIR
filters. The basic lattice structure is characterized by a single input and a
pair of output as shown in fig (5.6a). A lattice structure is derived from
the basic structure in fig (5.6a)
[ ]
+
x[n]
+
[ ]
Fig (5.6a) basic lattice structure.
stage1 [ ] stage2 [ ]
+ +
x[n]
+ [ ] + [ ]
Fig (5.6b) 2-stage FIR
+ +
16
[ ] [ ] Fig (5.6b) 2-stage IIR
17
[ ] = [ ] + [1] [ 1] + [2] [ 2] … (2) by using IZT
x[n]
+
y[n] fig (5.4a)FIR using Transversal
2) A two stage lattice structure for the filter is given in fig (5.4b). The
output of the structure are related to the input as
stage1 [ ] stage2
+
[ ]
+
x[n]
+ +
Fig (5.4b) [ ] [ ]
[ ]= + [ 1] [ ]= [ 1] + [ ]
[ 1] = [ 2] + [ 1]
= [ ]+ [ 1] + { [ 2] + [ 1]}
[ ]= [ ]+ [ 1] + [ 2] + [ 1]
[ ]= [ ]+ (1 + ) [ 1] + [ 2]… (3)
(1 + ) = [1]
[1]
= , = [2]
1 + [2]
1.3425
= = 0.706 , = 0.9025
1 + 0.9025
18
Ex 5.5
Discuss the five main steps involved in the design of digital filters, using
the following design problem to illustrate your answer.
A digital filter is required for real time noise reduction (in medical
application). The filter should meet the following amplitude response
specifications:
Passband 0 – 10 Hz
Stopband 20 – 64 Hz
Sampling frequency 128Hz
Maximum passband deviation < 0.036 dB
Stopband attenuation > 30dB
Solution:
1)Requirement specification.
3) Selection of filter
5) implementation
19
Finite Impulse response (FIR) filter design
Finite Impulse response (FIR) filter design
[ ]= [ ] [ ] … (6.1a)
k=0,1,2,… N
( )= ( ) … (6.1b)
Where h(k) :The impulse response coefficient of the filter.
H(z) : The transfer function of the filter
N: The filter length that is the number of the filter coefficients.
b) FIR filters can have an exactly linear phase response.
a) The phase delay of the filter is the amount of time delay for each
frequency components ( ).
b) The group delay is the average time delay of the composite signal
suffer at each frequency
The phase delay is the negative of the phase angle divide by frequency
where the group delay is the negative of the derivative of the phase with
respect to .
1
= ( )/ …. (6.2a)
where = time or phase delay for each frequency component.
( )
= …. (6.2a)
where = group delay (is the time delay of the composite signal at each
frequency.
A filter with a nonlinear phase characteristic will cause a phase distortion
in the signal that passes through it.
2
(2) FIR digital filter has impulse response, h(n) defined over the interval
0 1. Show that if N=7 and h[n] satisfies the symmetry
condition h[n]= h[N-n-1] the filter has a linear phase characteristic.
(3) Repeat (2) if N=8.
Solution
(1) The necessary and sufficient condition for a filter to have a linear
phase response must be symmetrical
[ ]= [ 1]
or [ ]= [ 1]
For nonrecursive FIR filters, the storage space for coefficients and the
number of arithmetic operations are reduced by nearly a factor of 2.
For recursive FIR filters the coefficient can be made to be simple
integers, leading to increased speed of processing.
In linear phase filters, all frequency components experience the same
amount of delay through the filter that is no phase distortion.
(2) Using the symmetry condition we find that for N=7
[ ]= [ 1]
[0] = [7 0 1] = [6]
Using the same way to fined [1] = [5]. [2] = [4]. [3] = [3].
( )= [ ] Substitute = ( )
( )= ( )
3
( )= [ [0] + [1] + [2] + [3] + [4]
+ [5] + [6] ]
Using the summitry condition we can group terms whose coefficients are
numerically equal
( )= [ [0]( + ) + [1]( + )
+ [2]( + ) + [3]
( )= [2 [0] cos(3 )
+ 2 [1] cos(2 ) + 2 [2] cos( ) + [3]]
Since we have n=7, symmetrical at n= =3
- If we let a[0]=2h[3] and a[n]=2h[3-n],a[1]=2h[2],a[2]=2h[1],
a[3]=2h[0] n=0,1,2,3
h[n]
0 1 2 3 4 5 6 n
( )= [ ] cos ( ) … (1a)
( )
= ±| ( )| …. (1b)
± | ( )| = ( ) cos
+ [3] +
7 5 3
= [2 [0] cos + 2 [1] cos + 2 [2] cos + 2 [3] cos ]
2 2 2 2
( )
= ±| ( )|
Where ±| ( )| = [ ] cos[ ]
7
( )= [ ]=2
2 2
Thus also the phase response is linear.
4
6.2 FIR filter design
As discussed before, the design of a digital filter involve:-
1. Filter specification
2. Coefficient calculation
3. Realization
4. Analysis of finite worldlength effects
5. Implementation
Note there are four types of linear phase FIR filters depending on whether
N is even or odd and whether h[n] has positive or negative symmetry.
6.3 FIR filter specification
- For the phase response we need only state whether positive symmetry
or negative symmetry is required.
- The amplitude-frequency response of an FIR filters is often in the
form of tolerance scheme as shown in fig (6.1) (also discussed before)
- The following parameters are:-
a) peak passband deviation or ripple
b) stopband deviation
c) passband edge frequency
d) stopband edge frequency
- and in decibels.
- For example the specification for physiological noise reduction are
5
6.4 FIR coefficient calculation methods
The object of most FIR coefficient calculation methods is to obtain values
of h[n] such that the resulting filter meets the design specifications, such
as amplitude-frequency response. Several methods are available for
obtaining h[n]
a) Window method
b) Optimal method
c) Frequency sampling method
6.4.1 Window Method
- The frequency response of a filter, ( ) and the corresponding
impulse response, [ ] are related by the inverse FT.
[ ]= ( ) …. (6.8)
The subscript D is used to distinguish between the ideal and practical impulse
response.
Let us consider to design a low pass filter with cutoff frequency as shown in fig
(6.2).
1 1
[ ]= =
2 2
1 1 2
= = =
2 2 2 2
=2 for < < … (6.9)
=2 for n=0 using Hopital transform
Hopital transform for n 0
( )
[ ]=2 =2 = 2 cos =2 =0
( )
( )
Fig (6.2)
[ ]
6
The impulse response for the ideal highpass, bandpass and bandstop
filters are obtained from the lowpass case of eq (6.9).
- From fig (6.2), an obvious solution to truncate the ideal response by
setting ( ) = 0 for n > M (where M is the length of the window).
However, this introduce undesirable ripples and overshoots the so
called Gibb's phenomenon , Direct truncation of [ ] as described
above is equivalent to multiplying the ideal impulse response by a
rectangular window of the form
[ ] . . . .…
w n
W(w) w(n)
w n
| ( )| [ ]= [ ] w[n]
w n
7
- The corresponding frequency response shows that the ripples and
overshoots are much reduced. However, the transition width is wider
than for the rectangular case.
- Several window functions have been proposed. One of the most
widely used window functions are Hamming window which is
defined by:
1 1
2 ,
[ ] = 0.54 + 0.46 cos 2 2 (6.11)
,
2 2
=0
Fig (6.4) compares the time and frequency domain characteristics of
common window functions (a) Rectangular (b) Hamming (c) Blackman.
- In the time domain, the Hamming window function decrease sharply
to ward zero. But the side lobe levels are smaller than the main lobe
by -40 dB.
- The appropriate relationship between the transition width for filter
designed with the Hamming window and filter length is given by
3.3
= … (6.12)
Where N is the filter length and the normalized transition width
(from passband to stopband). fig(6-4)
w[n] W(f)
-14db
(a) Rectangular
n f
w[n] W(f)
-43db
(b) Hamming
n f
w[n] W(f)
-55db
(c)Blackman
n f
8
Ex.6.2 Determine the coefficient of an FIR low pass filter for n=0, 1,2,-- 26
to meet the specification given below using the Hamming window
method
Passband edge frequency 1.5KHz
Transition width 0.5KHz
Stopband attenuation 50 dB
Sampling frequency 8KHz
Solution The ideal impulse response for low pass filter is given by
eq (6.9)
sin( )
[ ]=2 0
[ ]=2 if n=0 if n=0
.
= = 0.0625 [The normalized transition bandwidth]
Using eq (6.12) to find N
. .
But = = .
= 52.8 53
The filter coefficients are obtained from [ [ ] [ ]]
( )
Where [ ]= 0
[ ]=2 if n=0
Hamming window is given by
2
[ ] = 0.54 + 0.46 cos( ) 26 26
53
Because of the smearing effect of the window on the filter response, the
cutoff response of the resulting filter will be different from that given in
the specifications. To solve the problem, we will use an that is centered
on the transition band
.
9
.
The normalized = = 0.21875
Not that h[n] is symmetrical, thus we need only compute values for h[0],
h[1], ….. , h[26]
- n=0, =2 = 2 × 0.21875 = 0.4375
[0] = 0.54 + 0.46 cos(0) = 1
[0] = [0] [0] = 0.4375 × 1 = 0.4375
sin( ) × .
- n=1, [ ]= = sin(2 × 0.21875)
× .
sin[360 × 0.21875]
[1 ] = = 0.31219
2
[ ] = 0.54 + 0.46 cos
53
2
[1] = 0.54 + 0.46 cos(
) = 0.98713
53
(1) = ( 1) = [1] (1) = 0.31219 × 0.98713
= 0.31119
- Using the same procedure to find
(2) = ( 2) = [2] [2] = 0.06012
(26) = ( 26) = [26] [26] = 0.000913
- We note that the indices of the filter coefficients run from -26 to +26.
To make the filter causal, necessary for implementation, we add 26 to
each index so that indices start at zero.
- Advantage and disadvantage of the window method
1) An important advantage of the window method is its simplicity. It
is simple to apply and simple to understand. It involves a
minimum of computation.
2) The major disadvantage is its lack of flexibility. Both the peak
passband and stopband ripples are approximately equal, so that the
designer may end up.
10
6.4.2 The optimal method
- The optimal method of calculating FIR filter coefficients is very
powerful, very flexible, because of the existence of an excellent
design program.
- Basic concepts of the optimal method:-
1) The peak ripple of filters designed by the window method occur
near the band edges, and decreased away from the band edges as
shown in fig (6.5a).
2) The peak ripple of filter designed by the optimal method has the
same peaks (equiripple) in the passband or stopband as shown in
fig (6.5b). A better approximation of the desired frequency
response can be achieved when equiripple is satisfied.
3) The optimal method is based on the minimization of the maximum
weight error |E(w)| which is given by
|E(w)| = ( )[ ( ) ( )]
Where ( ) is the ideal or desired response.
( ) is a weighting function
( ) is a practical frequency response
4) A Fortran program that implements the above process is available
and is now widely used.
1 1
0.8 H(w) practical
w w
11
6.4.3 Frequency Sampling method
- The frequency sampling method allows us to design nonrecursive
FIR filters for both standard frequency selective filters (lowpss,
highpass, bandpass filters) and filters with arbitrary frequency
response. A main attraction of the frequency sampling method is that
it also allows recursive implementation of FIR filters.
4.4.3.1 Nonrecursive frequency sampling filters
- Suppose we wish to obtain the FIR coefficients of the filter whose
frequency response as shown in fig (6.6a).
- We could start by taking N samples of the frequency response at interval of
. = 0.1. … . 1
- The filter coefficients h[n] can be obtained by inverse DFT of the
frequency samples
( )
[ ]= ( ) … (6.13)
where H(k), k=0,1, … ,N-1 are samples of the ideal or target frequency
response.
- For linear phase filters, with positive symmetrical impulse response, we
can write (for N even)
( )
[ ]= [ 2| ( )| cos |[ ]| + (0)]……(6.14)
where = ( 1)/2. For N odd the upper limit in the summation is
( 1)/2. The resulting filter will have a frequency response that is
exactly the same as the original response at the sampling instant as shown
in fig (6.6c).
| ( )| fig (6.6)
(a)
H(k)
(b)
4 5 6 7 8 9 10 12 14 k
| ( )|
(c)
W
12
- An alternative frequency sampling filter, known type 2, results if we
take frequency sample at intervals of
1
= + = 0,1,2 , … , 1 … . (6.15)
2
- For a give filter specification, both methods will lead to somewhat
different frequency responses.
Ex 6.3 (1) show that the impulse response coefficient of a linear phase
FIR filter with positive symmetry for N even, can be expressed as
1 2 ( )
[ ] == [ 2| ( )| cos |[ ]| + (0)]
= ( )
=
=
13
- For the important case of linear phase h[n] will be symmetrical and so we can
write (for N even)
[ ]= | ( )| [ ( )/ + ( )] … ( . )
( )
[ ]= ( ) + ( )
= [ ( ) [ × ×( )+ ( ) [ × ×( )+ + +
= [ × ×( . )+ × . + ]= . ×
= × = . × =
14
Design of infinite impulse response
(IIR) digital filter
7.1 Design of infinite impulse response (IIR) digital filter
Realization IIR digital filters are characterized by the following recursive
difference equation
[ ]= [ ] [ ]= [ ] [ ] … (7.1)
Where h[k] is the impulse response of the filter, and are the
coefficients of the filter, and x[n] and y[n] are the input and output of the
filter. The transfer function for the IIR filter is
+ + +
( )= = … (7.2)
1+ + + 1+
- An important part of the IIR filters design to find the values of and
to satisfy the required filter characteristics. Eq (7.1) and (7.2) are
the characteristics equation for IIR filter.
- As shown in eq (7.1), the current output y[n] is a function of past
output y[n-k] as well as present and past input samples x[n-k].
- The strength of IIR filters comes from the flexibility the feedback
arrangement.
- IIR filters normally require fewer coefficients than FIR for the same
applications, which is why IIR filters are used when sharp cutoff and
high throughput are important requirements.
- The main problem of the IIR filter is the stability.
- The transfer function of IIR filter H(z) given in eq (7.2) can be
factored as
( )( )… ( )
( )= … (7.3)
( )( )… ( )
1
7.2 Design stages for digital IIR filters
- The design of IIR filters can be broken into five stages:-
1) Filter specification :( Type of the filter and specification).
2) Approximation or coefficient calculation.
3) Realization, which is simply converting the transfer function into a
suitable filter structure.
4) Analysis of errors due to the calculation of coefficients and using a
finite number of bits.
5) Implementation, which involves building the hardware and/or
software.
7.3 Stage1: Performance Specification. include the following
1) Signal characteristics (2) Frequency response
(3) The manner of implementation (4) Cost.
- For frequency selective filters, such as lowpass and bandpass filters,
the frequency response specifications are often in the form of a
tolerance schemes shown in fig (7.2) for an IIR parameters are used to
specify the frequency response:-
passband ripple parameter where the passband ripple is
passband deviation = 20 Log (1 + )
stopband deviation = 20 Log(1
and passband edge frequency and the stopband ripple is
and stopband edge frequency = 20 Log
- Passbnad and stopband deviations may be expressed as ordinary
number as in decibels.
|H(f)|
1
passband ripple
1
1+
/2 f
2
Fig (7.1) Tolerance scheme for an IIF bandpass filter.
The task of this stage to select one of approximation method and calculate
the value of and in eq (7.2). The main two methods are:
Im /4 |H(f)|
/2 0 Re
3 /4
0 f
(a) (b)
3
Ex. 7.1 A bandpass digital filter is required to meet the following
specifications:
1
= ( ( ) )
1 + 0.877969
Im
0.937
Re
-0.937
4
To find the difference equation, using the IZT
( ) 1
=
( ) 1 + 0.877969
( )[1 + 0.877969 ] = ( )[1 ]
Take IZT
[ ] = 0.87796 [ 2] + [ ] [ 2] ......... (1)
The block diagram is shown in fig (7.1b)
1
x[n] + y[n]
-1
comparing the difference equation
(1) with the general equation of IIR (2)
= 1. = 0. = 1
= 0. = 0.87796
-0.87796
Note:
The general equation of 2nd order is given by
[ ]= [ ] [ ]
= [ ]+ [ 1] + [ 2] [ 1] + [ 2]..... (2)
Ex. 7.2 Find the transfer function and difference equation of a simple IIR digital notch
filter that meets the following specifications
Notch frequency =50 Hz
3dB width of notch=±5Hz
Sampling frequency=500Hz
Using the pole-zero placement method nnn |H(f)|
Fig (7.2a)
f
Solution 50Hz
1) To reject the component at 50Hz, we place a pair of complex zeros at points on
the unit circle correspond 50Hz that is at angle 360 × = ±36 as shown in fig
(7.2b).
2) To achieve a sharp notch filter and improved Im
response on either side of notch frequency,
a pair of complex conjugate poles is placed at a radius.
Fig(7.2b) -1 R
5
±
=1 =1 =1 = 0.937 [ = 2 × 5 = 10 ]
3) The pole-zero diagrams in fig (7.2a). From the figure, the transfer
function of the filter is given by
( )( )
( )= . . where the angle of poles
( . )( . )
. . ( )
= = 360 × = 39.6
. . . .
The difference equation is determines by using IZT as mentioned in Ex.7.1
[ ]= [ ] 1.6180 [ 1] + [ 2] + 1.5161 [ 1] 0.878 [ 2]
Comparing y[n] with general equation
= 1, = 1.618, = 1, = 1.5161, = 0.8780
7.3.2 Impulse invariant method (first method of converting analogue filters
into equivalent digital filter)
- In this method, starting with a suitable analogue transfer function H(s),
the impulse response h(t) is obtained using the inverse of the Laplace
transform.
- The h(nT) is the sampled impulse response can be obtained by using
sampling to h(t) where T is the sampling interval.
- H(z) can be obtained by z-transform.
Ex. 7.3 Describe and derive the relationsship how to convert the
analogue filter into equivalent digital filter .Using the impulse invariant
method. Assume the transfer function of the analogue
RC low pass filter is given by
( )= … (7.4)
6
Solution (1) The impulse response, h(t), is given by the inverse Laplace
transform. Assume the transfer function of the analogue lowpass filter RC
is given by ( )= .
( )= [ ( )] = =
( )= ( ) = =
1
… . (7.5)
1
(3) To apply impulse invariant method to high order (for ex, Mth.order) IIR
filter with simple poles, the transfer function, H(s) is first expanded using
partial fractions as the sum of single pole filters
( )= + + . … . (7.6)
… (7.7)
1
7
High order IIR filters are normally realized as cascaded parallel
combinations of standard second order filter section. Thus the case when
M=2 is of particular interest
+ + … (7.8)
1 1
+ ( + )
=
1 ( + ) +
If the poles , are complex conjugates, then will be also
be complex conjugates
[ ( ) ( )]
+ .(7.9)
( )
Where and are the real and imaginary of .
and are the real and imaginary of .
For most practical impulse invariant IIR filters, the transformation given in
eqs(7.7), (7.8) and (7.9) are only transformations required to obtain the
coefficient.
1
( )=
+ 2 +1
Using the impulse invariant method obtain the transfer function, H(z), of
the digital filter, assuming a 3 dB cutoff frequency of 150Hz and sampling
frequency 1.28kHz.
8
1
( )= ( )| = =
+ 2 +1 + 2 +
= +
2 ± 2 4×1× 2 (1 ± )
= = = 666.4324(1 ± )
2 2
= 666.4324(1 + ), = = 666.4324(1 + )
= = 666.4324 , = = 666.4324
2
- Since the poles are complex conjugate, the transformation in eq (7.8) is
used to obtain the discrete time transfer function H(z)
Using the same procedure in Ex.3.12, 3.13 to find and . (Using partial
fraction)
= 0. = 666.43
= 0.5207. = 0.5207, = 0.5944
sin( ) = 0.4974. cos( ) = 0.8675
= 0.3530. Substitution these values into eq (7.9)
393.9264
( )=
1 1.0308 + 0.3530
To keep the gain down and to avoid overflow when the filter is implemented
in practice H(z) is multiplied by = = = 0.78
.
0.3078
( )=
1 1.0308 + 0.35
Using the same procedure in ex. [7.1, 7.2] to find DE and coefficients
+
x[n] 0.308 y[n]
1.0308
.
. .
0.3530
9
Summary of the impulse invariant method procedure for calculating IIR filter
coefficients
1) Determine a normalization analogue filter, H(s), that satisfies the
specifications for the desired digital filter.
2) If, necessary, expand H(s) using partial functions.
3) Obtain the z-transform of each partial fraction.
4) Obtain H(z). If the actual sampling frequency is used then multiply H(z) by
(sampling period= 1/ ).
Remarks on the impulse invariant method
1) The impulse response of the discrete filter, h[n] is identical to that of the
analogue filter, h(t), at the discrete time instants t=nT, n=0, 1, 2, … as
shown in fig (7.7a). It is for this reason this method is called the impulse
invariant method.
2) The sampling frequency affects the frequency response of the impulse
invariant discrete filter. High sampling frequency is necessary for
frequency response to be close to that of the equivalent analogue filter.
3) As in the case with sampling data systems, the spectrum of the impulse
invariant filter corresponding to H(z) would be the same that of the
analogue H(s), but repeats at multiplies of the sampling frequency as
shown in fig(7.8 a, b), leading to aliasing.
Fig (7.7a) |H(f)| fig(7.8 a)
h(t)
2 f
(a) Spectrum of an analogue filter
(b) Spectrum of an equivalent impulse
2T 4T 6T 8T 10T Time invariant digital filter showing effects
fig(7.7b) (nT interval) of aliasing.
10
7.3.3 Bilinear z-transform (BZT) method (second method of converting
analogue filter into equivalent digital filter)
BZT is the more important method of obtaining IIR filter coefficient. In the
BZT method, the basic operation required to convert an analogue filter H(s)
into an equivalent digital is to replaces as follow
1 2
= , =1 (7.9 )
+1
- The above transformation maps the analogue transfer, H(s), from the s-
plane into discrete transfer function H(z) in the z-plane as shown in Figs
(7.9 a,b). Notice that :-
a) In the figure the entire (jw) axis in the s-plane is mapped into the unit
circle.
b) The left half s-plane is mapped inside the unit circle.
c) The right half s-plane is mapped outside the unit circle.
d) The stable filter, with poles on the left half of the s-plane, will lead to a
digital filter with poles inside the unit circle.
Im(jw) Im
Re Re
11
3) Obtain an equivalent analogue filter cutoff frequency ( ) using the
relation (prewarped) to obtain the desirable response (without this step the
digital filter has undesirable filter).
= tan(
), = 1 (7.9 )
2 2
4) Denormalize the analogue filter by frequency scaling H(s). This is
achieved by replacing by .
5) Applying the bilinear transformation to obtain the desired digital filter
transfer function H(z) by replacing . (analogue)
Note = + = +
=
( )
= (digital)
( )
Ex. 7.5 Determine the transfer function and difference equation for the
digital equivalent of resistance – capacity (RC) filter. Assume a sampling
frequency of 150Hz and a cutoff frequency of 30Hz. Using the BZT
method. Draw the block diagram of the digital filter.
Solution ( )= … . (7.5.1)
1) The cutoff frequency =2 = 2 × 30 red/sec. (for digital)
2) The equivalent analogue filter cutoff is given by
= tan /2 where T=1/150 Hz
2 × 30
= tan = tan = 0.7265
150 × 2 5
3) The denormalized analogue filter transfer function is obtained from H(s)
as (using 7.5.1)
1 0.7265
( ) = ( )| = =
. +1 + 0.7265
0.7265
4) Using BZT
0.7265
( ) = ( )| =
1
+ 0.7265
+1
0.7265( + 1) 0.7265( + 1)
= =
1 + 0.7265(1 + ) (1 + 0.7265) + 0.7265 1
12
. ( )
H(z) = 0.4208
.
x(n) + y(n)
x[t] R y[t]
0.1584
13
7.4 Comments on the bilinear transformation method
- The BZT involves two separate transformation:-
1) The normalized analogue transfer function is frequency scaled by replacing s as
follows
2
= = tan =1
2
2) The BZT is applied by replacing s in the new transfer function as
1
=
+1
3) It is common practice in many texts to use the factor k=2/T.
It should be mentioned that both k=1 and k=2/T lead to the same results because k is
cancelled out anyway. To illustrate this consider the following simple filter
1
( )=
+1
Assuming that the digital filter is to have a cutoff frequency of , then we must
frequency scale H(s) with the following frequency
= tan( )
2
Then the transfer function is
1
( )= ( )| =
+1
tan( )
2
( )
Now we replace =
( )
( )= ( )|
1 1
= =
( 1) ( 1)
cot 2 +1
+1 ( + 1)
+1
[ 2 ]
From the above we see that the factor k is cancelled out it would not have
mattered whether k=1 or 2/T.
14
7.5 Use of classical analogue filters to design IIR digital filters
For standard frequency selective filtering tasks, H(s), can be derived from the
classic Butterworth, chebyshev or elliptic functions. Only low pass filter will
be considered, since it is straight forward to obtain other filter types
(bandpass, bandstop and so on) from normalized low pass filter.
7.5.1 Butterworth filter
The low pass Butterworth filter is characterized by the following squared
frequency response
| ( )| = … . (7.11) |H(f)|
( / )
- The transfer function, H(s), for the Chebyshev response depends On the
desired passband ripple and the filter order, N. The attenuation in decibles
and the filter order N are given by
15
Stopband attenuation 20 ( )
… . (7.15)
= =
= tan ( )
= tan ( )
(4) Apply BZT to the new H(s)
1
=
+1
16
Ex. 7.7 Convert the simple low pass filter (RC filter) into equivalent digital
high pass filter. Assume a sampling frequency of 150 Hz and a cutoff
frequency of 30Hz.
Determine the transfer function and difference equation.
Draw the block diagram of the high pass filter
Solution The critical frequency for the digital filter is = 2 × 30
and for analogue filter = tan( ), with T=1/50
2 × 30
= tan = 0.7265
2 × 150
- The s-plane transfer function of the low pass filter is given by
( )= …(7.8.1)
Using the LPF to HPF transformation of equation (7.18b), the
denormalized analog transfer function is obtains as
1 1
( )= ( )| = = =
0.7265 + 0.7265
+1 +1
The z-plane transfer function is obtained by applying the BZT
( )/( )
( )= ( )| = =( ) ( ) .
.
1 1
1 1
( )= =
(1 1 )+( 1
+ 1)0.7265 1.7265 0.2735 1
1
( ) = 0.5792
1 + 0.1584
( )
To fined DE
( )
= 0.5792 .
( )[1 + 0.1584 ] = 0.5792(1 ) ( )
Using IZT
[ ]= 0.158 [ 1] + 0.5791 [ ] 0.5791 [ 1]
Compare y[n] with eq (7.1)
[ ]= [ ] [ ]
17
Ex. 7.8 A discrete band pass filter with Butterworth characteristics meeting
the following specifications is required. Determine the transfer function H(z)
with pole-zero diagram. Using BZT. Starting with first order low pass filter.
Pass band =200-300Hz, sampling frequency=2000Hz and filter order=2.
Solution The prewarped pass band edge frequencies are given by
2 × 200
= tan = tan = 0.3249
2 2000 × 2
2 × 300
= tan = tan = 0.5095
2 2000 × 2
= = 0.3249 × 0.5095 = 0.1655
= = 0.5095 0.3249 = 0.1846
A first order normalized analogue filter is
1
( )= ( . 7.8.1)
+1
Using the low pass to band pass filter eq(7.18c)
1
( )= ( )| =
+
+1
= …[ . 7.8.2]
+ +
Applying the BZT to the analogue band pass filter
( 1)
( ) = ( )| = +1
( )
( 1)
( ) [( 1)/( + 1)] + +
+1
( 1)/(1 + + )
=
2( 1)
+ + (1 + )/(1 + + )
1+ +
Substituting the value of and W and simplifying we have
1
( ) = 0.1367 … ( . 7.8.3)
1 1.2362 + 0.7265
18
The pole-zero diagrams of the normalized LPF, the analogue band
pass filter and the discrete band pass filter are shown in fig (ex. 7.8).
using transfer function H(s), ( ) and H(z) according eqs.
Ex.[7.8.1, 7.8.2, 7.8.3].
s-plane Im s-plane Im
R R
(a) (b)
Im
z-plane
R
(c)
a) Pole-zero diagrams for a reference LPF eq(7.8.1)
b) Intermediate analogue band pass filter eq(7.8.2)
c) Discrete band pass filters by BZT eq(7.8.3)
… (7.8.1)
… (7.8.2)
… (7.8.3)
. .
19