Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1
Adawy
Transform domain representation
of discrete time signals
2
Adawy
Representation of continuous systems
Most of continuous systems can be represented by:
Linear constant coefficients differential equation
Transfer function or system function
Impulse response
Frequency response
C S Y (s) d S
i 0
i
i
i 0
i
i
X (s)
System function
N or Transfer
Y (s)
i
c S i
function
H (s) i 0
M
X (s)
i
d
i 0
S i
Y(s)=H(s), y(t)=L-1{Y(s)}=L-1{H(s)}=h(t)
Impulse response
4
Adawy
In general y(t)=L-1{H(s)X(s)}= h(t) * x(t)
Convolutio
n operation
y (t ) h( ) x(t )d x( )h(t )d
5
Adawy
Difference equations
General form of a system difference equation is:
N M
a
k 0
k y[n k ] br x[n r ]
r 0
ak
N M
br
y[n] y[n k ] x[n r ]
k 1 a 0 r 0 a 0
y[0]=ay[-1]+x[0]=1
y[1]=ay[0]+x[1]=a
y[2]=ay[1]+x[2]=a2
…………………
y[n]=an
8
Adawy
Fourier Transform
لقد كان العالم فورير عمره 30عاما عندما كان أحد أعضاء الحملة الفرنسية على
مصر عام 1798وعين حاكما على مصر العليا ،وتقدم بعدة أبحاث علمية للمعهد
العلمى المصرى الذى أنشأه نابليون فى مصر .ثم عاد بعد ذلك إلى فرنسا حيث قدم
أفكاره لحل مشاكل االنتقال الحرارى للمعهد الفرنسى عام . 1807لقد تركزت أفكاره
على أن اإلشارة الدورية يمكن تمثيلها بمجموعة محدودة من اإلشارات الجيبية
المتوافقة .كما أوضح أيضا أن اإلشارة الغير دورية يمكن تمثيلها بالمجموع التكاملى
من اإلشارات الجيبية الغير متوافقة .هاتين الفكرتين هما األساس لما عرف فيما بعد
ويعرف اآلن بتتابع فورير Fourier seriesومحول فورير Fourier
Transformاللذين كان لهما أكبر األثر على كل فروع الهندسة وبالذات هندسة
االتصاالت واإللكترونيات ومعالجة اإلشارات .
لقد تم استخدام كل من تتابع فورير ومحول فورير لما يقرب من 200عام لتمثيل
الظواهر االنسيابية فى الزمن االنسيابى .مع ظهور األنظمة الرقمية وأزمنة الزمن
المقطع ظهرت الحاجة إلى محول فورير المقطع Discrete Fourier
9 . Transform, DFT
Adawy
ما هى الفائدة من تحويل أو وضع إشارة مركبة فى صورة مجموعة
من اإلشارات الجيبية ؟ ولماذا اإلشارة الجيبية بالذات ولم تكن المربعة
مثال ؟
فى الكثير من األحيان يصعب التعامل مع هذه اإلشارات المركبة ،فال يمكن مثال
حساب استجابة (خرج) نظام لمثل هذه اإلشارات .عند وضع اإلشارة فى صورة
مجموعة من اإلشارات البسيطة يسهل حساب استجابة النظام لكل واحدة من هذه
اإلشارات على حده ثم تجميع هذه االستجابات فنحصل على استجابة النظام لإلشارة
المركبة .هذا ما يسمى بنظرية التجميع . Superposition
أما لماذا اإلشارة الجيبية بالذات فألن اإلشارة الجيبية لها ميزة ليست موجودة فى أى
إشارة أخرى وهى أن استجابة أى نظام خطى لإلشارة الجيبية هى أشارة جيبية
أيضا تختلف فقط فى المقدار والزاوية ولها نفس التردد .
10
Adawy
Getting a square wave from a series of sinusoids
F(t)=…+(2/pi*45)*cos(45*pi*t)
12
Adawy
Classification of signals
Signal
Discrete Continuous
Periodic Periodic
Aperiodic Aperiodic
13
Adawy
Fourier Transform for signals
Continuous periodic
Fourier series
Continuous aperiodic
Fourier Transform
Discrete aperiodic
14
Adawy
Continuous Fourier Series
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:
f (t ) F e
k
k
jkot
15
o 2 / T
Adawy
Fk are given by:
1 T
Fk
T 0
f (t )e jkot dt
These are the coefficients in the exponential form. They can
be represented in a sinusoidal form as follows:
f (t ) ao (ak Cos (kot ) bk Sin(kot )
k 1
1 T
ao f (t )dt
T 0
2 T
ak f (t )Cos (kot ) dt
T 0
2 T
16
bk
T
0
f (t ) Sin( kot ) dt
Adawy
Fourier Transform for continuous
aperiodic functions
Fourier Transform, FT
17
Adawy
Any signal can be represented in one of these two
domains:
FT
Frequency domain Time
IFT domain
Amplitudeِ
Amplitudeِ
Time
Frequency
Spectrum analyzer
Oscilloscope
18
Adawy
The Discrete Time Fourier Transform, DTFT
It is the Fourier transform of aperiodic discrete time
sequences.
X (e jw ) x[ n
n
]e jwn
X (e ) X re (e ) jX im (e )
jw jw jw
j ( w )
X ( e ) X (e ) e
jw jw
Angle or phase
Magnitude
X (e jw ) ( 0
n
.5) n
u[ n ]e jwn
e
( 0
n 0
. 5) n jwn
1
(0.5e jw n
) jw
n 0 1 0.5e
20
Adawy
1
X (e )
jw
jw
1 0.5e
21
The inverse Discrete Time Fourier Transform, IDTFT
1
x[n]
jw jwn
X (e )e dw
2
x[n]
n
X (e jw )
22
Adawy
DTFT properties
1- Linearity
2- Time shift
4- Differentiation in frequency
6- Modulation
1
g[n] h[n] DTFT
2
G (e j ) H (e j ( w ) )d
24
Adawy
Discrete Fourier Transform, DFT
Inverse DFT
N 1
1
x[ n]
N
X [k ]W
k 0
kn
N n=0,1,2,…..N-1
x1[n]x 2[m n]
m 0
X1[k]X2[k]
6- Modulation 1 N 1
x1[n]x2[n]
N
X 1[m] X 2[k m]
m 0
12 3 4 5 12 3 4 5 12 3 4 5 1 2 3 4 5
X[n]
29 X[n-1] X[n-2] X[n-3]
Adawy
Circular convolution
N 1
linear convolution
y L [n] g[k ]h[ n k ]
k 0
n=0,1,2,3,….N+M-1
N 1 Circular
y C [n] g[ k ]h[n k ] N convolution
k 0
n=0,1,2,3,….N-1
4 1
y C [ n] g[k ]h[n k ] 4 n=<3<=0 g[k]=[1 2 0 1]
k 0 h[-k]=[2 1 1 2]]
30 yc[0]=g[0]h[0]+g[1]h[-1]+g[2]h[-2]+g[3]h[-3]=1x2+2x1+0x1+1x2=6
Adawy
yc[1]=g[0]h[1]+g[1]h[0]+g[2]h[-1]+g[3]h[-2]=1x2+2x2+0x1+1x1=7
g[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=5
g[k]=[1 2 0 1]
h[3-k]=[1 1 2 2]
yc[n]=[6 7 6 5]
j 2 / N
WN e ,K=0,1,2,…..N-1
DFT
IDFT
N 1 N 1
1 1
32
x[n]
N
X [k ]e
k 0
j 2kn / N
N
X [k ]W
k 0
kn
N
Adawy
N 1
X [k ] Re( x[n]) j Im( x[n]) Re(W Nkn ) j Im(W Nkn )
n 0
N 1 N 1
kn
Re( x[n]). Re(W N ) Im( x[n]). Im(W N )
kn
n 0 n 0
N 1 N 1
kn
j Re( x[n]). Im(WN ) Im( x[n]). Re(WN )
kn
n 0 n 0
33
Adawy
N real multiplications N real multiplications
N 1 N 1
kn
X [k ] Re( x[ n]). Re(W N ) Im( x[n]). Im(W N )
kn
n 0 n 0
N real multiplications N real multiplications
N 1 N 1
kn
j Re( x[ n]). Im(WN ) Im( x[ n]). Re(WN )
kn
n 0 n 0
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.
n 0
7 6 5 4 3 2 1 0 n
k
1 1 1 1 1 1 1 1 0
(1+j)/ √2 J -(1-j)/√2 -1 -(1+j)/ √2 -j (1-j)/√2 1 1
j -1 -j 1 j -1 -j 1 2
-(1-j)/√2 -j (1+j)/ √2 -1 (1-j)/√2 J -(1+j)/ √2 1 3
-1 1 -1 1 -1 1 -1 1 4
-(1+j)/ √2 J (1-j)/√2 -1 (1+j)/ √2 -j -(1-j)/√2 1 5
-j -1 j 1 -j -1 j 1 6
36 (1-j)/√2 -j -(1+j)/√2 -1 -(1-j)/√2 j (1+j)/ √2 1 7
Adawy
Fast Fourier Transform, FFT
Put n=2r in the first sum, n=2r+1 in the second sum, to get
even and odd indexed points
N / 2 1 N / 2 1
X [k ] x[
r 0
2 r ]W 2 rk
N x[
r 0
2 r 1]W ( 2 r 1) k
N
2
W
39
2 rk
N
W 2 rk
N e j ( 2 / N ) 2 rk
e
j
N /2
rk
W rk
N /2
Adawy
N / 2 1 N / 2 1
X [k ] x[2r ]W
r 0
rk
N /2 W k
N x[2r 1]W
r 0
rk
N /2
X [k ] G[k ] W H [k ] k
N
k=0, 1, 2, .., N-1
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.
40
Adawy
X [k ] G[k ] W H [k ] k
N
k=0, 1, 2, .., N-1
x[0] G[0]
0 X[0]
x[2] G[1]
W N
1 X[1]
x[4]
N/2 W N
G[2] X[2]
point W 2
N
DFT
x[N-2] G[N/2-1] X[N/2-1]
N / 2 1
W N
x[1] H[0] X[N/2]
N /2
x[3] H[1] WN X[N/2+1]
N / 2 1
x[5]
N/2
H[2]
W
N
point N / 2 2 X[N/2+2]
DFT
W
N
x[N-1] H[N/2-1] X[N-1]
N 1
W N
N point combining
41 algebra
Adawy
Each one of the N/2 point sequences can be decimated
further into two sequences of lengths N/4
x[0] N/2 point combine
N/4 X[0]
x[4] point
algebra W N0
W N1 X[1]
DFT
x[N-4] X[2]
W N2
x[2] N/4
x[6] point
x[N-3] DFT X[N/2-1]
N / 2 1
W N
x[1] X[N/2]
N /2
x[5]
N/4
point
W N X[N/2+1]
N / 2 1
x[N-2] DFT W N
N / 2 2 X[N/2+2]
x[3]
W N
N/4
x[7] point
x[N-1] DFT X[N-1]
N 1
W N
X [k ] Ge[k ] WNk / 2 Go[k ] He[k ] WNk / 2 Ho[k ]
42 P=4(N/4)2+2(N/2)+N=N2/4+2N Adawy
Final concept for decomposition in the decimation in
time FFT
2 point N/4 point X[0]
combining
DFT algebra X[1]
N/2 point
combining X[2]
2 point algebra
N/4 point
DFT combining
algebra X[N/2-1]
N point
2 point combining
algebra X[N/2]
DFT N/4 point
combining
X[N/2+1]
algebra
N/2 point
combining
algebra
N/4 point
2 point combining X[N-1]
algebra
DFT
Stage 1 Stage log2(N)=v, N=2v
The combining algebra at each stage takes N complex multiplication, so total
43
multiplications P= N.log2(N). Adawy
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] 0 0 0
X[0]
W 2 W 4
W 8
x[4] X[1]
W21 W 1
W 1
4 8
x[2] X[2]
W 0 W42 W 2
2 8
x[6] X[3]
W21 W43 W 3
8
x[1] X[4]
0 0 4
W 2 W 4 W
8
x[5] X[5]
W21 W 1
W 5
4 8
x[3] X[6]
W 0 W42 W 6
2 8
x[7] X[7]
44
W21 W 3
W 7
4 8
Adawy
An interesting feature in all previous butterflies
W 0 W83
2
W21
W 0
1 W83 W841 W84 .W81 1.W81 W81
2
j 2 1 / 2 j
W e
2
1
e 1 W87 W881 W88 .W81 1.W81 W81
0 W87
W 2 -1
Redraw
previous
figure
45 W83 -1 Adawy
This gives a further reduction in the number of
complex multiplication to (N/2).log2(N)
x[0] X[0]
x[4] X[1]
W20 -1
x[2] X[2]
W40 -1
x[6] X[3]
W20 -1 W41 -1
x[1] X[4]
W80 -1
x[5] X[5]
W20 -1 W81 -1
x[3] X[6]
W40 -1 W82 -1
x[7] X[7]
46
W20 -1 W41 -1 W83 -1
Adawy
Comparison for number of complex multiplications
obtained by direct method and FFT method
49
Adawy
Example
Calculation of the DFT of a sinusoidal sequence with
certain frequency.
Sampling frequency
% calculation of the fft much larger than 20Hz
freq=10; % frequency of the input sinusoid the Nyquest rate for the
fs=64; %sampling frequency 10Hz freq. There will be
N=32; %length of the DFT no aliasing
k=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]|');
50
Adawy
Input freq. F=10 Hz
Digital frequency
w=ΩTs=2pi10/64=2pik/32
51
Adawy
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
Digital frequency
w=ΩTs=2pi10/64=2pik/64
So,
54
the impulse at f=11Hz in the analog frequency will appear
at k=5 and 6 in the digital freq. domain Adawy
Using fft to calculate convolution of two sequences
%demonistration of the IFFT
g=[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'); New sequence
disp(real(y)); 2.0000 6.0000 5.0000 5.0000
55 4.0000 1.0000 1.0000
Adawy