View
118
Download
3
Category
Preview:
Citation preview
1
Fourier Transform, FT
Adawy
2
Transform domain representation of discrete time signals
Adawy
3
Representation of continuous systemsMost of continuous systems can be represented by:
Linear constant coefficients differential equation
Transfer function or system function
Impulse response
Frequency response
1- Linear constant coefficient differential equation
)(...)()(
01
1
1 tycdt
tydc
dt
tydc
N
N
NN
N
N
)(...)()(
01
1
1 txddt
txdM
dt
txdd
M
M
MM
M
M
y(t) is the system output, x(t) is the system input
Adawy
4
Take Laplace transform with all initial conditions zeros, then the last equation can be written as:
N
i
M
i
ii
ii sXSdsYSC
0 0
)()(
M
i
ii
N
i
ii
Sd
Sc
sX
sYsH
0
0
)(
)()(
System function or Transfer
function
Y(s)=H(s)X(s) If x(t)=δ(t), impulse function, X(s)=1
Y(s)=H(s), y(t)=L-1Y(s)=L-1H(s)=h(t)
Impulse response
Adawy
5
In general y(t)=L-1H(s)X(s)= h(t) * x(t)
Convolution operation
dthxdtxhty )()()()()(
A system is stable if all the poles of H(s) are in the left hand side of the S plane
Adawy
6
Difference equations
General form of a system difference equation is:
N
k
M
rrk rnxbknya
0 0
][][
][][][0 01 0
rnxa
bkny
a
any
M
r
rN
k
k
Present output Present and previous M inputs
Previous N output
A sequential method can be used to get a closed form solution for y[n]
Adawy
7
Example
y[n]=ay[n-1]+x[n], y[n]=0 for all n<0, x[n]=δ[n]
y[0]=ay[-1]+x[0]=1
y[1]=ay[0]+x[1]=a
y[2]=ay[1]+x[2]=a2
…………………
y[n]=an
The Z transform can be used to solve difference equation
Adawy
8
What Are Sinusoids?
Cosine wave Sine wave
Low frequency Middle frequency High frequency
Adawy
9
Fourier Transform
عاما عندما كان أحد أعضاء الحملة 30لقد كان العالم فورير عمره وعين حاكما على مصر العليا ، 1798الفرنسية على مصر عام
وتقدم بعدة أبحاث علمية للمعهد العلمى المصرى الذى أنشأه نابليون فى مصر . ثم عاد بعد ذلك إلى فرنسا حيث قدم أفكاره
. لقد 1807لحل مشاكل االنتقال الحرارى للمعهد الفرنسى عام تركزت أفكاره على أن اإلشارة الدورية يمكن تمثيلها بمجموعة محدودة من اإلشارات الجيبية المتوافقة . كما أوضح أيضا أن
اإلشارة الغير دورية يمكن تمثيلها بالمجموع التكاملى من اإلشارات الجيبية الغير متوافقة . هاتين الفكرتين هما األساس لما عرف فيما
Fourier ومحول فورير Fourier seriesبعد ويعرف اآلن بتتابع فورير Transform اللذين كان لهما أكبر األثر على كل فروع الهندسة
وبالذات هندسة االتصاالت واإللكترونيات ومعالجة اإلشارات .
لقد تم استخدام كل من تتابع فورير ومحول فورير لما يقرب من عام لتمثيل الظواهر االنسيابية فى الزمن االنسيابى . مع ظهور 200
األنظمة الرقمية وأزمنة الزمن المقطع ظهرت الحاجة إلى محول .Discrete Fourier Transform, DFTفورير المقطع
Adawy
10
ما هى الفائدة من تحويل أو وضع إشارة مركبة فى صورة مجموعة من اإلشارات الجيبية ؟
ولماذا اإلشارة الجيبية بالذات ولم تكن المربعة مثال ؟
فى الكثير من األحيان يصعب التعامل مع هذه اإلشارات المركبة ، فال يمكن مثال حساب استجابة )خرج( نظام لمثل هذه اإلشارات .
عند وضع اإلشارة فى صورة مجموعة من اإلشارات البسيطة يسهل حساب استجابة النظام لكل واحدة من هذه اإلشارات على
حده ثم تجميع هذه االستجابات فنحصل على استجابة النظام .Superpositionلإلشارة المركبة . هذا ما يسمى بنظرية التجميع
أما لماذا اإلشارة الجيبية بالذات فألن اإلشارة الجيبية لها ميزة استجابة أى نظام ليست موجودة فى أى إشارة أخرى وهى أن
خطى لإلشارة الجيبية هى أشارة جيبية أيضا تختلف فقط فى المقدار والزاوية ولها نفس التردد .
Adawy
11
This is our original One sine Two sines
Four sines Seven sines Fourteen sines
Adawy
Getting a square wave from a series of sinusoids
12
F(t)=…+(2/pi*45)*cos(45*pi*t)
Getting a series of pulses from a series of sinusoids
Adawy
13
Classification of signals
Signal
ContinuousDiscrete
Periodic
Aperiodic
Periodic
Aperiodic
Adawy
14
Fourier Transform for signals
Continuous periodic
Fourier series
Continuous aperiodic
Discrete aperiodic
Fourier Transform
Discrete Time Fourier Transform
Adawy
15
Continuous Fourier Series
k
otjkkeFtf )(
o
To /2
Any periodic continuous function f(t), with a periodic time T, can be represented as a sum of exponential (sinusoids)
functions of T as follows:
For all values of t
Fk is called the series coefficients, is the fundamental frequency, and it is given by:
Adawy
16
T otjk
k dtetfT
F0
)(1
1
)()(()(k
kk otkSinbotkCosaaotf
T
dttfT
ao0
)(1
T
k dtotkCostfT
a0
)()(2
T
k dtotkSintfT
b0
)()(2
Fk are given by:
These are the coefficients in the exponential form. They can be represented in a sinusoidal form as follows:
Adawy
17
Fourier Transform for continuous aperiodic functions
Fourier Transform, FT
Inverse Fourier Transform, IFT
Adawy
18
Any signal can be represented in one of these two domains:
Time domain
Frequency domain
Oscilloscope
Time
fAmplitude
Frequency
Spectrum analyzer
FT
IFT
fAmplitude
Adawy
19
The Discrete Time Fourier Transform, DTFT
It is the Fourier transform of aperiodic discrete time sequences.
n
jwnjw enxeX ][)(
)()()( jwim
jwre
jw ejXeXeX )()()( wjjwjw eeXeX
MagnitudeAngle or phase
This is called frequency spectrum, amplitude spectrum, and phase spectrum Adawy
20
We can see that:
X(ejw) is a continuous function of w
X(ejw) is periodic of w
e jӨ(w) =e j(Ө(w)+2pi k) =e jӨ(w)
Example X[n]=(0.5)n u[n]
0
)5.0(][)5.0()(n
jwnn
n
jwnnjw eenueX
jwn
njw
ee
5.01
1)5.0(
0
Adawy
21
jwjw
eeX
5.01
1)(
22
The inverse Discrete Time Fourier Transform, IDTFT
dweeXnx jwnjw)(
2
1][
Convergence of the DTFT
n
jwnjw enxeX ][)(
If the sequence x[n] is absolutely summable, then the DTFT converges to a continuous function of w.
n
nx ][ )( jweX
Adawy
23
DTFT properties
1- Linearity
A g[n] + B h[n] A G(ejw) + B H(ejw)DTFT
2- Time shift
g[n-n0] e-jwn0 G(ejw)DTFT
3- Frequency shifting
ejwn0 g[n-n0] G(ej(w-w0))DTFT
4- Differentiation in frequency
n g[n] jdG(ejw)/dwDTFT
Adawy
24
5- Convolution
g[n] * h[n] G(ejw) H(ejw)DTFT
6- Modulation
g[n] h[n]
deHeG wjj )()(2
1 )(DTFT
The DTFT of the convolution of two sequences equal to the product of the DTFT of both sequences. In some applications (when it is difficult to calculate or even draw
the convolution of two sequences) its convenient to calculate the convolution of the two sequences by
calculating the multiplication of the DTFT of the two sequences and find the IDTFT.
Adawy
25
Discrete Fourier Transform, DFT
It is applied to the aperiodic discrete time signals with definite lengths. The produced DFT is itself discrete.
Because it is discrete, it is the one that is used to represent discrete signals in the frequency domain. There are many special algorithms to speed up the calculation of
the DFT.It can be viewed as a special case of the DTFT. For a finite
length sequence x[n], 0<=n<=N-1, it is found that N samples of the DTFT X(ejw) are sufficient to determine x[n]. So it is obtained by uniformly sampling X(ejw) on the w axis between 0<=w<=2pi at wk=2pi k/N, k=0, 1, 2, …, N
1
0
/2
/2][)(][
N
n
Nknj
Nkw
jw enxeXkX
K=0,1,…N-1Adawy
26
X[k] is called the DFT, it is a finite length sequence of length N.
NjN eW /2
1
0
][][N
n
knNWnxkX
Inverse DFT
1
0
][1
][N
k
knNWkXN
nx n=0,1,2,…..N-1
As it will be seen computation of DFT or IDFT requires N2 complex multiplications, and N(N-1)
complex additions. Any algorithm used to calculate X[k] can be used to calculate x[n].
Adawy
27
The DFT can be put in a matrix form as follows:
X = D xX[0]
X[1]
.
.
.
X[N-1]
1 1 1 . . . . 1
1NW
2NW
)1(2 NNW2
NW4NW
1NNW
1NNW
)1(2 NNW
)1)(1( NNNW
………
………
………
.
.
1
1
1
=
x[0]
x[1]
.
.
.
x[N-1]
The IDFT can be put in a matrix form as follows:
x=D-1X D-1=(1/N)*ND
Adawy
1
0
/2][][N
n
NknjenxkX
1
0
][N
n
knNWnx
28
Properties of DFT
1- Because X(ejw) is periodical then X[k], and x[n] are periodical. So, both the DFT, and IDFT are both a finite length sequence that represent one period of a periodic
sequence.
2- The only difference between the calculation of the DFT and the IDFT is the scaling factor, (1/N) and the sign change in the exponent term. So, one algorithm can be modified to
calculate any of them.
3- Linearity If x1n] X1[k], and x2[n] X2[k]
Then Ax1[n]+Bx2[n] AX1[k] + BX2[k]
4- Time shift x[n-no] knoN
Nknoj WkXekX ][][ /2
Adawy
29
Circular shift of a sequenceImagine the sequence x[n] is displayed on the
circumference of a cylinder at N equally spaced points, then the circular shift operation can be viewed as rotating
the cylinder clockwise or anticlockwise.
1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5X[n] X[n-1] X[n-2] X[n-3]
Adawy
5- Circular convolution
1
0
][2][1N
m
nmxnx X1[k]X2[k]
6- Modulation
1
0
][2][11 N
m
mkXmXNx1[n]x2[n]
30
Circular convolution
1
0
][][][N
kL knhkgny
linear convolution
n=0,1,2,3,….N+M-1
1
0
][][][N
kNC knhkgny
Circular convolution
g[n]=[1 2 0 1], h[n]=[2 2 1 1]
14
04][][][
kC knhkgny 0<=n=<3
yc[0]=g[0]h[0]+g[1]h[-1]+g[2]h[-2]+g[3]h[-3]=1x2+2x1+0x1+1x2=6
g[k]=[1 2 0 1]
h[-k]=[2 1 1 2]]
Adawy
n=0,1,2,3,….N-1
31
yc[1]=g[0]h[1]+g[1]h[0]+g[2]h[-1]+g[3]h[-2]=1x2+2x2+0x1+1x1=7g[k]=[1 2 0 1]
h[1-k]=[2 2 1 1]
yc[2]=g[0]h[2]+g[1]h[1]+g[2]h[0]+g[3]h[-1]=1x1+2x2+0x2+1x1=6
g[k]=[1 2 0 1]
h[2-k]=[1 2 2 1]
yc[2]=g[0]h[3]+g[1]h[2]+g[2]h[1]+g[3]h[0]=1x1+2x1+0x2+1x2=5g[k]=[1 2 0 1]
h[3-k]=[1 1 2 2]
yc[n]=[6 7 6 5]
Circular convolution of two equal length sequences gives a sequence with the same length.
Adawy
32
Calculation of the DFT
We defined the N point DFT of an N point sequence x[n] as the N samples of the Fourier transform X(ejw) of that
sequence evaluated uniformly on the w axis at w=2πk/N, where 0≤k≤N-1:
1
0
1
0
/2/2 ][][|)(][
N
n
N
n
knN
NknjNkw
jw WnxenxeXkX
NjN eW /2 ,K=0,1,2,…..N-1
1
0
1
0
/2 ][1
][1
][N
k
N
k
knN
Nknj WkXN
ekXN
nx
DFT
IDFT
Adawy
33
)Im()Re(])[Im(])[Re(][1
0
knN
knN
N
n
WjWnxjnxkX
1
0
1
0
)Im(]).[Im()Re(]).[Re(N
n
N
n
knN
knN WnxWnx
1
0
1
0
)Re(]).[Im()Im(]).[Re(N
n
N
n
knN
knN WnxWnxj
Adawy
34
1
0
1
0
)Im(]).[Im()Re(]).[Re(][N
n
N
n
knN
knN WnxWnxkX
1
0
1
0
)Re(]).[Im()Im(]).[Re(N
n
N
n
knN
knN WnxWnxj
N real multiplications N real multiplications
N real multiplications N real multiplications
Each term of X[k] requires 4N real multiplications. As X[k] consists of N terms (k varies from 0 to N-1), then to evaluate
X[k] for all k requires 4NXN=4N2 real multiplications.
By the same way direct evaluation of X[k] requires NX(4N-2) real additions.
Simply, direct evaluation of X[k] requires N2 complex multiplications, and N(N-1) complex additions.
Adawy
35
1
0
/2][][N
n
NknjenxkX
The good news is that, many of these multiplications turns out to be redundant, because the exponential term is
periodic and will give no more than N distinct values. So, the same products are calculated many times as k and n varies
from 0 to N-1.Efficient FFT algorithms try to reduce these redundancy.
Another problem with direct implementation of the DFT is the calculation of the exponential term itself directly ( or as
sine and cosine terms). This is a very time consuming problem and an efficient FFT algorithm must reduce the use
of such functions.
Adawy
36
1
0
1
0
/2 ][][][N
n
knN
N
n
Nknj WnxenxkX
n
k
01234567
011111111
11(1-j)/√2-j-(1+j)/ √2-1-(1-j)/√2J(1+j)/ √2
21-j-1j1-j-1j
31-(1+j)/ √2J(1-j)/√2-1(1+j)/ √2-j-(1-j)/√2
41-11-11-11-1
51-(1-j)/√2-j(1+j)/ √2-1(1-j)/√2J-(1+j)/ √2
61j-1-j1j-1-j
71(1+j)/ √2j-(1-j)/√2-1-(1+j)/√2-j(1-j)/√2
For k varies from 0 to 7, and n varies from 0 to 7 we demonstrate the redundancy of the exponential term exp(-j2πkn/N)
Adawy
37
Fast Fourier Transform, FFT
Many methods for reducing the number of multiplications have been investigated since 50 years ago.
Multiplication is more critical than addition because it consumes more time.
The most widely used methods of FFT are based on decomposing or breaking the transform into smaller
transforms, and combining them to give the total transform. There are two methods to do this decomposition or
decimation:
Decimation In Time FFT
Decimation In Frequency FFT
Adawy
38
Decimation In Time FFT
The number of points in the input sequence are assumed to be power of 2; N=2s.
In this approach we break the N, x[n] points into two groups, each of them is N/2 points. The first group is the
even indexed points x[0], x[2], x[4] , … x[N-2]. The second group is the odd indexed points x[1], x[3], …, x[N-
1]. Find the DFT of each group.
Each one of the previous groups is further decimated into two N/4 points by the same way and find the DFT of
each decimated group
This process continues until you end up with 2 points in each group and find the DFT for those two points
Adawy
39
1
0
][][N
n
knNWnxkX
Break the sequence x[n] into even and odd indexed points
1
,1
1
,0
][][][N
oddn
knN
N
evenn
knN WnxWnxkX
Put n=2r in the first sum, n=2r+1 in the second sum, to get even and odd indexed points
12/
0
)12(12/
0
2 ]12[]2[][N
r
krN
N
r
rkN WrxWrxkX
rkN
rkNj
rkNjrk
Nrk
N WeeWW 2/2/
22)/2(22
Adawy
40
12/
02/
12/
02/ ]12[]2[][
N
r
rkN
kN
N
r
rkN WrxWWrxkX
N/2 point DFT of the even
indexed pints.
N/2 point DFT of the odd
indexed pints.
][][][ kHWkGkX kN k=0, 1, 2, .., N-1
This represents the first step in this algorithm. Breaking the sequence into two N/2 sequences and find the DFT
of each of them. The total number of complex multiplication P=(N/2)2+(N/2)2+N=N2/2 +N
In the last equation for k=N/2 to N, both G[k], and H[k] are periodic. So, G[N/2]=G[0], G[N/2+1]=G[1], and so on.
Adawy
41
][][][ kHWkGkX kN k=0, 1, 2, .., N-1
N/2 point DFT
N/2 point DFT
x[0]
x[2]
x[4]
x[N-2]
x[1]
x[3]
x[5]
x[N-1]
G[0]
G[N/2-1]
G[2]
G[1]
H[0]
H[N/2-1]
H[2]
H[1]
0NW1NW2NW
12/ NNW
2/NNW
12/ NNW
22/ NNW
1NNW
X[0]
X[1]
X[2]
X[N/2-1]
X[N/2]
X[N/2+1]
X[N/2+2]
X[N-1]
N point combining algebra
Adawy
42
Each one of the N/2 point sequences can be decimated further into two sequences of lengths N/4
N/4 point DFT
x[0]
x[4]
x[N-4]
x[2]
x[1]
x[5]
x[N-1]
0NW1NW2NW
12/ NNW
2/NNW
12/ NNW
22/ NNW
1NNW
X[0]
X[1]
X[2]
X[N/2-1]
X[N/2]
X[N/2+1]
X[N/2+2]
X[N-1]
N/4 point DFT
N/4 point DFT
N/4 point DFT
x[6]
x[N-3]
x[N-2]
x[3]
x[7]
][][][][][ 2/2/ kHoWkHekGoWkGekX kN
kN
P=4(N/4)2+2(N/2)+N=N2/4+2N
N/2 point combine algebra
Adawy
43
X[0]
X[1]
X[2]
X[N/2-1]
X[N/2]
X[N/2+1]
X[N-1]
N point combining
algebra
N/2 point combining
algebra
N/2 point combining
algebra
N/4 point combining
algebra
N/4 point combining
algebra
N/4 point combining
algebra
N/4 point combining
algebra
2 point
DFT
2 point
DFT
2 point
DFT
2 point
DFT
Final concept for decomposition in the decimation in time FFT
Stage 1 Stage log2(N)=v, N=2v
The combining algebra at each stage takes N complex multiplication, so total multiplications P= N.log2(N). Adawy
44
We reduced the number of complex multiplication from N2 to N.log2(N) which is a great time saving.
Example Flow graph for an 8 point FFT
x[0]
x[4]
x[2]
x[6]
x[1]
x[5]
x[3]
x[7]
X[0]
X[1]
X[2]
X[3]
X[4]
X[5]
X[6]
X[7]
02W
12W
12W
12W
12W
02W
02W
02W
04W
14W
24W
34W
04W
14W
24W
34W
08W
18W
28W
38W
48W
58W
68W
78W
Adawy
45
An interesting feature in all previous butterflies
The horizontal scale factor can be rewritten as the negative of the diagonal scale factor
02W
12W
102 W
12/1212 jj eeW
38W
78W
18
18
18
48
148
38 .1. WWWWWW
18
18
18
88
188
78 .1. WWWWWW
02W -1
38W -1
Redraw previous
figure
Adawy
46
x[0]
x[4]
x[2]
x[6]
x[1]
x[5]
x[3]
x[7]
X[0]
X[1]
X[2]
X[3]
X[4]
X[5]
X[6]
X[7]
02W
02W
02W
02W
04W
14W
04W
14W
08W
18W
28W
38W
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
This gives a further reduction in the number of complex multiplication to (N/2).log2(N)
Adawy
47
Number of stages
v
Number of points
N
N2(N/2)log2(N)Ratio of N2 to (N/2)log2(N)
241644
3864125.333
416256328
53210248012.8
664409619221.33
71281638444836.57
825665536102464
95122621442304113.77
10102410485765120204.8
Comparison for number of complex multiplications obtained by direct method and FFT method
Adawy
48
Shuffling the input data
Natural order of
input data
3 bit codeBit reversal
code
Shuffled data
x[0]000000X[0]
x[1]001100X[4]
x[2]010010X[2]
x[3]011110X[6]
x[4]100001X[1]
x[5]101101X[5]
x[6]110011X[3]
x[7]111111X[7]
Adawy
49
FFT using MATLAB
fft(x) fft(x,N)
ifft(x) ifft(x,N)
The function fft(x) computes the DFT of a vector x with the same length as x. The function fft(x,N) computes an N points DFT of the vector x. If N<x then x is padded with zeros, if N<x
then x is truncated to the first N points. The functions ifft() works the same way.
MATLAB uses the decimation in time radix 2 algorithm in calculating the DFT if the input sequence is a power of 2. If x
is not power of 2, it uses mixed algorithms with the radix 2 algorithm, but it takes more time in this case.
Adawy
50
Example
Calculation of the DFT of a sinusoidal sequence with certain frequency.
% calculation of the fftfreq=10; % frequency of the input sinusoidfs=64; %sampling frequencyN=32; %length of the DFTk=0:N-1;f=sin(2*pi*freq*k/64);subplot(2,1,1);stem(k,f);grid;ylabel('X[n]');F=fft(f);subplot(2,1,2);stem(k,abs(F));grid;xlabel('frequency index k');ylabel('|x[k]|');
Sampling frequency much larger than 20Hz the Nyquest rate for the 10Hz freq. There will be
no aliasing
Adawy
51
Input freq. F=10 Hz
Input Ω=2pi10 rad/sec, Analog frequency
Digital frequency w=ΩTs=2pi10/64=2pik/32
From which k=5
So, the impulse at f=10Hz in the analog frequency will appear at k=5 in the digital freq. domain
Adawy
52
As the input sequence x[n] is pure sinusoid, its Fourier transform should be two impulses at +10Hz, and -10Hz,
and zero elsewhere. As we saw in the last figure the 10Hz appears as X[5] in the DFT frequency domain at location
k=5. The impulse at -10Hz appears at X[27] at location 32-5=27. So, the DFT is correctly calculated.
Remember that the digital spectrum is a repeated versions of the analog spectrum around half the sampling frequency fs. So the first half of the DFT samples for k=0 to k=N/2-1 corresponds to the positive analog frequency axis f=0 to
f=fs/2. While the second half for k= N/2 to k=N-1 corresponds to f=-fs/2 t0 f=0.
f10-10
Analog spectrum
fs/2fs/2 k0 N-1
Adawy
53
Previous example with N=64Input freq. F=10 Hz
Input Ω=2pi10 rad/sec, Analog frequency
Digital frequency w=ΩTs=2pi10/64=2pik/64
From which k=10
So, the impulse at f=10Hz in the analog frequency will appear at k=10 in the digital freq. domain
Adawy
54
Same previous example with
f=11Hz, N=30, fs=64Hz
Input freq. F=11 Hz
Input Ω=2pi11 rad/sec, Analog frequency
Digital frequency w=ΩTs=2pi11/64=2pik/32
From which k=11/2
So, the impulse at f=11Hz in the analog frequency will appear at k=5 and 6 in the digital freq. domain Adawy
55
%demonistration of the IFFTg=[1 2 0 1];ga=[g zeros(1,length(h)-1)]subplot(3,1,1);stem(ga);ylabel('First sequence');h=[2 2 1 1];ha=[h zeros(1,length(g)-1)]subplot(3,1,2);stem(ha);ylabel('Second sequence');G=fft(ga);H=fft(ha);Y=G.*H;y=ifft(Y);subplot(3,1,3);stem(real(y));ylabel('Result sequence');disp('New sequence');disp(real(y));
Using fft to calculate convolution of two sequences
New sequence 2.0000 6.0000 5.0000 5.0000 4.0000 1.0000 1.0000
Adawy
Recommended