Professional Documents
Culture Documents
SignalProcessing - SS2023 Part - 5-dft-fft
SignalProcessing - SS2023 Part - 5-dft-fft
1. Introduction
2. Characteristics of signals
3. Analog signals in frequency domain
4. Analog LTI systems
5. Sampling theorem and reconstruction
6. Discrete time signals in frequency domain
7. Discrete time LTI systems
8. Digital filters
9. Correlation
10. Advanced topics
173
6 Discrete time signals within the frequency domain
6.1 Discrete Fourier transform (DFT)
§ Introduction
§ Characteristics
6.2 The DFT as approximation
§ the discrete time Fourier transform
§ the Fourier transform
§ the Fourier sequence
6.3 Fast Fourier transform (FFT)
6.4 Windowing and spectral analysis
6.5 Spectral analysis of stationary and non-stationary signals
§ Motivation
§ Spectrogram
174
6.1 Discrete Fourier Transform (DFT) - Introduction
Motivation
§ Numerical calculation of the spectrum, which means of the frequency content of a (analog or discrete time) signal,
e.g.,
- Calculation of the spectrum of a communication signal
- Vibration analysis of mechanical objects
- Definition of the harmonic overtone at the output of a non-linear amplifier
- Search of sine-signals within the noise
§ The DFT can be very efficiently calculated by means of the FFT (Fast Fourier Transform).
175
6.1 Discrete Fourier Transform (DFT) - Introduction
§ Fourier transform (general spectrum)
+ +
§ Fourier series (line spectrum of a periodic signal using the Fourier coefficients)
,4/% +
1
q: = T <6 (!)e*$%&:(4) d! <6 (!) = V q: e$%&:(4)
)# :-*+
*,4/%
§ Discrete time Fourier transform (periodic spectrum of the discrete time signal)
+ ($ /%
1
>! (:) = V <[']e*$%&",$( <['] = T >4 (:)e$%&",$( d:
"-*+
:4
*($ /%
176
6.1 Discrete Fourier Transform (DFT) - Introduction
177
6.1 Discrete Fourier Transform (DFT) - Introduction
Annotations
§ The values >[l], which are in general complex, are often called DFT-coefficients.
The parameter ' in <['] is the discrete time variable or the time index or the sample index.
Analog to this, the parameter l in >[l] is called discrete frequency variable.
§ The sequence of the DFT-coefficients >[l] is periodic with period e.
§ Usually, >[l] is calculated only for one period, which is l = 0,1, … e − 1.
§ Usually, however not exclusively, the DFT is applied to time signals with finite length.
§ After the inverse transform, the sequence can be interpreted as a periodic signal with the period e.
The basic period for ' = 0,1, … e − 1 matches (i.e., is equal) with the original signal <['].
§ The step size (sampling distance) in time domain is the inverse of the period in frequency domain and vice versa.
! time (continuous)
< < < < "* = 1/& distance of sampling points in time domain
!; = = = >⋅= ; %; = ? = >⋅? " = ' ( "* signal length in time domain
o o &* = 1/" distance of sampling points in frequency domain
& = ' ( &* signal length in frequency domain
= sampling frequency )*
" #
' =" =# ="(& number of samples (sampling points)
' '
178
6.1 Discrete Fourier Transform (DFT) - Introduction
7*9
1
<' = V > l ⋅ ]7 *:⋅" ' = 0,1, … , e − 1
e
:-#
§ As already mentioned, DFT, respectively IDFT are mostly evaluated only for one period:
l = 0,1, … , e − 1, respectively ' = 0,1, … , e − 1
179
6.1 Discrete Fourier Transform (DFT) - Introduction
<[e − 1] >[e − 1]
s E = tE u E
180
6.1 Discrete Fourier Transform (DFT) - Introduction
181
6.1 Discrete Fourier Transform (DFT) - Introduction
Rotation phasor
vE = e&'!(/E
W83
W81
W8 2
182
6.1 Discrete Fourier Transform (DFT) - Introduction
imaginary
axis
Rotation phasor and Kronecker symbol W86
§ The discrete Q-function is now W85 j W87
7*9
:*: ; W 1 for l = l J
V ]" = e ⋅ Q:,: ; with the Kronecker−Symbol Q:,: ; =E W88= W80
0 otherwise W84
W-# 1 real
axis
§ e ⋅ Q:,: ; fulfills the same task in the discrete Fourier transform as the Dirac pulse
W83 W81
for the continuous Fourier transform.
W82
§ The above equation shows that if we sum up all phasors, we will get zero,
except all phasors point to ]"# (i.e., 3 o’clock), which is enforced by l = l J .
In this case, we get:
W80·0 W80·1 W80·2 W80·3 W80·4 W80·5 W80·6 W80·7
183
6.1 Discrete Fourier Transform (DFT) - Characteristics
§ Linearity
Ø<9 ['] + ∞<% ['] ∘−• Ø>9 [l] + ∞>% [l]
§ Periodicity
> l => l+e
<['] = <[' + e]
§ Parseval-Theorem
7*9 7*9
%
1 %
V <['] = V >[l]
e
"-# :-#
The energy of a sampled signal can be calculated in time as well as in frequency domain.
§ Symmetry for a real-valued time signal
e e 0, 1, 2, … e even
> + ± = >∗ −± , ±=E
2 2 0.5, 1.5, … e odd
184
6.1 Discrete Fourier Transform (DFT) – Example 1
! Y = 1 for Y = 0, … , 3, r = 4; constant function
-./
0123+
input ![%] Expectation: for the continuous Fourier transform → Q(0) ; D = E 6 * e. -
% .,!
u u
&; : &; : .
x[0] x[1] x[2] x[3] <1 = B 1 ⋅ e/ v ⋅.⋅- = B e/ v = 1 + −j + −1 + j = 0
.,! .,!
As ![%] is an even function,
output <[U] u
&; :
u
v; : .
<[U] does not contain
/ v ⋅.⋅& / any imaginary part.
<2 = B1⋅e = Be v = 1 + −1 + 1 + −1 = 0
4
.,! .,!
u u
&; : w; : .
<[3] = B 1 ⋅ e/ v ⋅.⋅u = B e/ v = 1 + j + (−1) + (−j) = 0
U .,! .,!
X[0]X[1]X[2]X[3]
.6< .6<
9 X ⋅"⋅: 9 ⋅"⋅#
Control by inverse transform: < ' = ∑ > l e = = ⋅4⋅e = = 1 for ' = 0, … , 3
K :-# K
185
6.1 Discrete Fourier Transform (DFT) – Example 2
<[0] = 1, <[1] = 0, <[2] = −1, <[3] = 0, N = 4; "cosine"
-./
input ![%] ; D = E 6 * G-34+
j
W43 Expectation: for the continuous
1 +,%
Fourier transform → Q : + Q(−:) -./
% 1
0 W4 2 W44= W40 6* = E ; D G-.34+
x[0] x[1] x[2] x[3] '
1 > 0 = 0 (corresponds to the sum) 3,%
-1
9⋅# 9⋅%
W41 > 1 =1⋅]
K + −1 ⋅ ]
K = 1 ⋅ 1 + −1 ⋅ −1 = 2
periodic "3o ' clock " "9 o ' clock "
output <[U] continuation 2 %⋅# %⋅%
2 >[2] = 1 ⋅ ]
K + −1 ⋅ ]K = 1 ⋅ 1 + −1 ⋅ 1 = 0
"3o ' clock " "3o ' clock "
U U X⋅# X⋅%
>[3] = 1 ⋅ ]
K + −1 ⋅ ]
= 1 ⋅ 1 + −1 ⋅ −1 = 2
K
X[0] X[1] X[2] X[3] X[-2]X[-1] X[0] X[1]
"3o ' clock " "9 o ' clock "
interval interval
§ Since we have a real and even input signal, exactly the same values are in the right half as in the left: >[e − l] = >[l]
§ If we would have a real and odd input signal, the conjugated complex values would be in the right half as in the left:
>[e − l] = > ∗ [l]
186
6.1 Discrete Fourier Transform (DFT) – Example 3
<[0] = 0, <[1] = 1, <[2] = 0, <[3] = −1, N = 4; "sine" -./
U >[3] = 1 ⋅ ]KX⋅9 + −1 ⋅
]KX⋅X = 1 ⋅ j + −1 ⋅ −j = 2j
U "12 o ' clock " "6o ' clock "
-2j -2j
§ Since we have a real and odd input signal, we get in the right half the conjugated complex as from the left half:
>[e − l] = > ∗ [l]
187
-./
; D = E 6 * G-34+
6.1 Discrete Fourier Transform (DFT) 1
+,%
-./
6* = E ; D G-.34+
'
3,%
e
tim
188
6.2 The DFT as approximation of the Fourier Transform
: = lä/e
189
6.2 The DFT as approximation of the Fourier Transform
Proof
§ For the Fourier Transform of a sampled signal, the following holds
+
§ If a time-continuous signal <(!) is limited to an interval of duration )# , the Fourier transform >(:) can be
approximated with the DFT at the discrete frequency points : = lä4 /e:
ä4 e e
> l ≈ )4 > l for l = − ,…, − 1
e 2 2
191
6.2 The DFT as approximation of the Fourier Transform
Example:
192
6.2 The DFT as approximation of the Fourier Transform
§ The distance
ä 1
ä4 = =
e e)4
§ The term resolution refers here to the distance of two sample points in frequency domain of
the DFT spectrum. It should not be mixed up with the minimal frequency distance, which two
sine oscillations must have to separate them in the DFT spectrum.
193
6.2 The DFT as approximation of the Fourier Transform
§ The DFT would be perfect, if our signal is limited in time and frequency domain.
§ However, this is impossible, since a signal limited in time has an infinite spectrum and
a signal limited in frequency has an unlimited time series.
§ Thus, using DFT, we always violate (hopefully only slightly) the sampling theorem.
§ We will see later (“Windowing”) how we can minimize this violation of the sampling theorem.
194
6.2 The DFT as approximation of the Fourier Transform
§ Under the condition that exactly one or several full periods of a periodic signal are sampled,
the Fourier coefficients can be calculated according to the following formula:
1
q: ≈ >[l] for l = −e/2, . . . , e/2 − 1
e
§ The same equation will hold if the periodic signal is band-limited and the sampling theorem is maintained.
§ For correct sampling, one has to keep the following points in mind:
- The length of the measuring windows has to be equal to one or more full periods of the signal.
- The value at the left edge is sampled.
- The value at the right edge is not sampled anymore.
195
6.2 The DFT as approximation – Choice of parameters
§ For the analysis of a signal by means of the DFT (FFT), it is necessary to carefully choose
the following parameters:
§ P2 sampling frequency (corresponds to period in frequency domain)
§ &2 sampling time
§ T number of samples
§ & measuring duration
§ r2 distance between two frequency points after the transform (frequency resolution)
% = r%5
35 1 1
p5 = Δ3 = = =
r r%5 %
§ Hence, only two parameters are free to be chosen, all other parameters result immediately from this choice.
196
6.2 The DFT as approximation – Choice of parameters
Choice of the sampling frequency :4
§ The right choice is mainly given by the sampling theorem. The following has to apply:
35 > 23IJK
197
6.2 The DFT as approximation – Choice of parameters
Support for the choice of the amount e of the samples
§ The measuring duration ) = e)4 has to be as long or longer as the signal duration.
§ e should be, if possible, a power of two to calculate the DFT using the FFT
§ For the DFT, the frequency distance ä4 between two samples in frequency equals :4 /e.
If you want to choose ä4 , e must be
:4 N=12
e≥
ä4
§ To increase the spectral resolution,
e has to be increased (e.g., using Zero Padding).
N=16
§ If a periodic signal is analyzed and
the period duration )# of the signals is known,
then e has to be chosen e) = )# .
198
6.2 The DFT as approximation – Applications
Example
§ Given a sine oscillation, switched on at ! = 0 and damped in time
)
*>
< ! = r# sin 25 :# ! ⋅ e D !
with the time constant 7 = 1 s, r# = 1 V and the frequency :# = 1 Hz.
§ The Fourier transform of this function results in
25:# r#
>(:) =
(j25: + 1/7)% + (25:# )%
199
6.2 The DFT as approximation – Applications
§ Input: damped sine oscillation
and sampling Dirac comb
units of <: V
units: Vs
200
6.2 The DFT as approximation – Applications
Mean value, root mean square value and total harmonic distortion of a signal
§ In many applications, the following values are important:
§ Mean value (DC-value, linear mean value)
§ Root mean square value (RMS-value)
§ Root mean square value of the AC component (AC-part)
§ Total harmonic distortion (harmonic content)
201
6.2 The DFT as approximation – Applications
Mean value, root mean square value and total harmonic distortion of a signal
§ Root mean square value >`x[ of the periodic signal <(!): 29N5 ≈ 2L- ! + 2M- !
∑z/q{|
syq Ps q
§ Total harmonic distortion: Q ≈ (for even r)
∑z/q{|
sy| Ps q
The total harmonic distortion is defined as the relation of the root mean square values of all harmonics to the
root mean square value of the complete AC component (including the fundamental signal). Thus, it is a measure
for the deviation from a pure sinusoidal signal.
202
6.3 Fast Fourier Transform (FFT)
James W. Cooley,
*1926, † June 29 John Wilder Tukey
2016, (* 16. June 1915,
† 26. July 2000)
§ The FFT (Fast Fourier Transform), published in 1965 in a famous article of Cooley and Tukey,
is the most important algorithm in digital signal processing.
§ The FFT is not a novel transform – but an efficient method to calculate the DFT.
! 0 , r = 1 ⟹ 2 0 = ![0]
Ø The number itself
203
6.3 Fast Fourier Transform (FFT)
We start with the definition of the DFT:
E&$
2 [ = J ! Y vE 4" [ = 0,1, . . . , r − 1
41/
with
§ l discrete frequency variable
§ ' discrete time variable
§ e number of samples, number of frequency samples
§ >[l] discrete Fourier transform at the frequency point : = l:4 /e
or the lth DFT-coefficient
§ <['] sample of <(!) at the point ! = ')4 = '/:4
§ ]7 rotation phasor ]7 = e*$%&/7
204
3/-
<[U] = B ![%]x3 .~ U = 0,1, . . . , T − 1
6.3 Fast Fourier Transform (FFT) .,!
Calculation cost
§ In order to calculate the DFT at one frequency point, e multiplications and e − 1 summations have to be processed.
§ If the DFT should be calculated at all e frequency points, e2 multiplications and e(e − 1) summations
have to be processed.
§ The FFT-algorithm provides another method, with which the DFT can be calculated with
significantly less calculation cost.
§ Thereby, it is presumed that e is a power of two, which means it can be written in the form e = 2\ with ∑ ∈ ℕ.
205
6.3 Fast Fourier Transform (FFT)
FFT-algorithm
§ At first, we split the sequence <['] into two subsequences
for ' = 0, … , e/2 − 1. The first subsequence consists of all samples with even index 2'
and the second subsequence of all samples with odd index 2' + 1.
§ Now, we can write for the DFT-sum (l = 0, … , e − 1):
7*9 7/%*9 7/%*9
206
3 3
& /- & /-
< U = B !- % x3&.~ + x3~ B !& % x3&.~
6.3 Fast Fourier Transform (FFT) .,! .,!
§ With
%& %&
%": *$ 7 %": *$ ":
]7 =e =e 7/% = ]7/% ":
we can write
7 7
% *9 % *9
> l = V <9 ' ]7⁄% ": + ]7 : V <% ' ]7⁄% ":
"-# "-#
= >9 l + ]7 : >% l
for l = 0, … , e − 1.
207
>[l] = >9 [l] + ]7 : >% [l]
6.3 Fast Fourier transform (FFT)
208
6.3 Fast Fourier Transform (FFT)
Calculation cost
§ Each of the two e/2-DFTs requires e/2 % multiplications.
§ The multiplication with the factor ]7 : needs additional e multiplications.
§ Total cost: 2 · (e⁄2)% +e
§ Compared to the original e2 operations, the calculation cost is significantly reduced for large e.
209
6.3 Fast Fourier Transform (FFT)
§ Segmentation of a 8-point DFT
in 4 times 2-point DFTs
210
6.3 Fast Fourier Transform (FFT)
§ Complete segmentation
of an 8-point DFT
211
6.3 Fast Fourier Transform (FFT)
Butterfly Operation
§ The processing of a butterfly operation requires
two complex multiplications, which is equivalent to
2 • 4 real multiplications.
§ Thus, a calculation cost of @ multiplications
per segmentation level is needed.
§ Total calculation cost for a @-point FFT: @ log2(@)
§ Example 1: 1024-points DFT
§ Direct calculation of the DFT after the defining equation leads to approximately 106 multiplications.
§ Calculation by means of the FFT only leads to approximately 104 operations.
§ Example 2: A song of 1 minute length is sampled with -@ = 44.1 kHz, resulting in @ = 221 samples. Using a
computer with D = 0.2 µs for one multiplication, the following times result for calculating the spectrum:
§ Direct calculation of the DFT: 0.2 µs · 2H(HI = 244.3 h ≈ 10 days
§ Calculation by means of the FFT: 0.2 µs · 221 · log H 2HI = 8,8 s
212
6.3 Fast Fourier Transform (FFT)
§ With
vE Q#E/! = vE E/! vE Q = −vE Q
E
§ The total calculation cost results in log ! ( r).
!
213
6.3 Fast Fourier Transform (FFT)
§ Complete graph of an
8-point FFT
214
6.3 Fast Fourier Transform (FFT)
Annotations
§ e should be chosen as a power of two (2, 4, 8, 16, 32, 64, 128, 256,…).
§ If the number of samples is not a power of two, one can add zeros (zero-padding) until e is power of two.
§ Since the FFT-algorithm is the most known DSP-algorithm, many software algorithms already exist
so that nowadays only very rarely somebody has to program it her-/himself.
215
6.3 Fast Fourier Transform (FFT)
x[0]
§ Example: “saw tooth”
x[2]
<[0] = 0, <[1] = 1, <[2] = 2 <[3] = 3, N = 4;
x[1]
input
WN1
x[3]
1
0 2
0 6
j
W43 1 -2
2 -2+2j
W44= W40
W42 4 1
1 1 -2
1 -2 -j
W4 1
3 -2-2j
216
6.4 Windowing and spectral analysis
§ For any application of the DFT (FFT), a sample sequence limited in time domain is required.
§ Often, however, one would like to perform a spectral analysis of a continuous sampling signal.
§ Consequently, it is necessary to temporally limit the continuous sequence.
§ One talks then about the Windowing of the sampling signal.
§ We look at the following applications, which can be performed by means of an appropriate Windowing
and subsequent FFT:
§ Detection of sine signals
§ Short-time spectral analysis of audio signals
217
6.4 Windowing and spectral analysis
The algorithm of the DFT assumes a periodic continuation of the signal. However, it is very unlikely that the
signal to be analyzed shows an integer number of periods within the analyzed time window.
Ø Only then, the periodic continuation of the analyzed time window corresponds
to the original function.
Ø Only in this case, the DFT represents a good approximation of the Fourier transform.
periodic
continuation
218
§ The period of the signal, which has to be analyzed,
6.4
Windowing and and the sampled time window do not match.
→ DFT is not a good approximation of
spectral analysis the Fourier transform.
periodic
continuation
bath tub
due signal jump 219
6.4 Windowing and spectral analysis
§ Example 1: given the following signal:
The frequency :# has to be measured, thus it is unknown. The analysis is done with FFT.
For that, the signal has to be sampled and the FFT-parameter have to be chosen carefully.
§ For a successful application of the FFT, it is important to have a rough idea of the signal,
which has to be analyzed, such as
§ In which frequency domain is the signal?
§ What is the amplitude range?
§ Is it superimposed by noise?
§ A rough overview of these parameters is necessary so that the parameter of the FFT (such as e and :4 )
can be chosen adequately.
220
6.4 Windowing and spectral analysis
§ Presumption: The frequency :# to be measured is in the kHz domain.
221
6.4 Windowing and spectral analysis
222
6.4 Windowing and spectral analysis
§ Example 2: We will now analyze what happens if we cut a signal <(!) and then perform the Fourier transform.
We cut <(!) anywhere – if possible, there, where the signal is no longer large.
*_)
< ! = Ee for t > 0
0 for ! < 0
+ + 9 + 9
>(:) = ∫*+ <(!) ⋅ e*$%&() d! = ∫# e*_) e*$%&() d! = e*_) e*$%&() #
= (Lorenz-curve)
*_*$%&( _@$%&(
*_)
§ Now, we cut: < ! = Ee für 0 ≤ ! < )
0 otherwise
, 9 , 9*D>?5><.6@5
>(:) = ∫# e*_) e*$%&() d! = e*_) e*$%&() #
=
*_*$%&( _@$%&(
*D>?5><.6@5
§ Compared to the uncut signal, we obtained an additional term .
_@$%&(
This term is not really large for large ), but it has the nasty characteristic to oscillate.
§ On top of the smooth Lorenz-curve, we get small oscillations (ripples) due to the truncation.
223
6.4 Windowing and spectral analysis
§ Conclusion: Never cut without any need and especially not so rough.
§ Instead: Gently weight the signal to zero.
§ The hard cutting of the signal (in example 1 at 4 ms) means that the signal <['] was multiplied
with a window function Ω['] (here rectangle-shaped):
§ Leakage: Through this convolution, parts of the spectral energy of the signal
gets spread over a wide frequency domain.
224
6.4 Windowing and spectral analysis
§ This rectangular window is inappropriate for most applications because of its very high side lobes.
§ For example, if we have in the signal a second frequency with a significantly smaller amplitude near by the
strong peak, it could be covered completely by the side lobes of the strong peak and, thus, it can not be
recognized.
225
6.4
Windowing and spectral analysis –
Rectangular window
Main lobe
Amplitude in dB
Frequency
227
6.4 Windowing and spectral analysis – Rectangular
Rectangular window, time domain Frequency domain in dB, N=41
Scaled amplitude in dB
Amplitude
Samples Frequency
228
6.4 Windowing and spectral analysis
§ Already Fourier knew about the problem of the leakage (side lobes).
§ At first, the leakage seemed very confusing: Where do all these frequencies come from?
Finally, it turned out that the additional frequencies stem from the jump from zero to the first point
and from the last point back to zero.
§ People assumed that this leakage cannot be avoided because one has to start and stop with
the data anywhere and exactly there has to be a jump.
§ Maurice S. Bartlett suggested to get rid of the jump discontinuity by multiplication of the data
with a so-called weighting function.
2Y r−1
Maurice S. Bartlett 0≤Y≤
(* 1910 in Scrooby, England, ÇS6Q,T>,, Y = r−1 2
† 2002 in Exmouth, England) 2Y r−1
2− ≤Y ≤r−1
r−1 2
229
6.4 Windowing and spectral analysis – Bartlett window
Bartlett (“Dreieck“) window, time domain Frequency domain in dB, N=41
2% T−1
0≤%≤
y\Ä= % = T−1 2
2% T−1
2− ≤%≤T−1
T−1 2
Scaled amplitude in dB
Samples Frequency
230
6.4 Windowing and spectral analysis
Modified rectangular window according to Bartlett
Modified Bartlett window in time domain, N=41
§ A window, which is
adjustable between
rectangle and Bartlett.
Scaled absolute amplitude in dB, N=41
Scaled amplitude in dB
§ The side lobe suppression
is also situated between
Samples
rectangle and Bartlett.
Frequency
231
6.4 Windowing and spectral analysis
§ Bartlett’s idea was partially correct – the high-frequency side lobes have been reduced but
they did not disappear completely. His idea was good, but not perfect.
§ Bartlett was a little bit disappointed, because he expected that all “wrong” frequencies will disappear
as soon as the curve is continuous.
§ According to Bartlett, the following effects generate high-frequency side lobes:
§ Discontinuities (steps or jumps)
§ Discontinuities in the derivative (corners)
§ Discontinuities in the second derivative (change of the gradient)
§ Discontinuities in every derivative
§ The high-frequency decline of the side lobes in the spectrum 1/: (R@9) results from
the lowest non-continuous derivative æ.
Examples
– Rectangular: spectrum sin(<)/<, the side lobes decline with 1/: #@9 , i.e., 1/:
– Triangular: spectrum (sin(<)/<)% , the side lobes decline with 1/: 9@9 , i.e., 1/: %
– Sine: continuous in all derivatives, side lobes decline with 1/: +
232
6.4 Windowing and spectral analysis – Hann window
1 2=Y
ÇU644 Y = 1 − cos 0≤Y ≤r−1
2 r−1
§ The width of the main lobe becomes j = 7.8 5 /e, which is twice
as big compared with the rectangular window. The attenuation of the first
side lobe is already 31.5 dB.
Julius Ferdinand von Hann
(* 1839 Castle Haus, Wartberg over Aist,
† 1921 in Vienna)
233
6.4 Windowing and spectral analysis – Hann window
Hann window, time domain Frequency domain in dB, N=41
1 25'
ΩOA"" ' = 1 − cos
2 e−1
Scaled amplitude in dB
0≤' ≤e−1
Samples Frequency
234
6.4
Windowing and spectral analysis
– Hamming window
§ With the Hamming-window, the side lobe suppression is improved further.
Through the insertion of a parameter ∞, the Hann-window is modified and, ´
thus, a reduction of the unwanted spectral parts is achieved:
25'
ΩOARR5"P ' = 1 −∞ − ∞ ⋅ cos 0≤' ≤e−1
e−1
§ Through a proper choice of ∞, a complete cancellation of the main maxima Richard Wesley Hamming
within the stop band can be achieved. ( *1915 in Chicago, Illinois;
† 1998 in Monterey, Kalifornien)
§ The maximum side lobe level of the Hann window is given by the first side lobe by ; = 55/e.
<F6
aABCCD:E D 8
If we force = 0 , then it follows that ∞ = 0.46.
aABCCD:E (9)
§ Hence, we define a new window function called Hamming-window:
25'
ΩbARR5"P ' = 0.54 − 0.46 ⋅ cos 0≤' ≤e−1
e−1
§ From above equation, we calculate for ΩbARR5"P (0) = ΩbARR5"P (e − 1) = 0.08.
Therefore, the Hamming-window is also called the "Raised-Cosine-window" with Platform.
235
6.4
Windowing and spectral analysis
– Hamming window
Hamming window, time domain Frequency domain in dB, N=41
%&"
ΩOARR5"P ' = 0.54 − 0.46 ⋅ cos
7*9
0≤' ≤e−1
Scaled amplitude in dB
Samples Frequency
236
6.4
Windowing and spectral analysis
– Blackmann window
§ The Blackmann window is also an often used window function:
2= Y 4= Y
ÇST62"<64 (Y) = 0.42 − 0.5 cos + 0.08 cos
r−1 r−1
§ The frequency response has a relatively wide main lobe, the side lobe level
is very good: j = 12 5/e, the first side lobe is already damped to 57 dB.
237
6.4
Windowing and spectral analysis
– Blackmann window
Blackman window, time domain Frequency domain in dB, N=41
ΩcWAd:RA" ' =
25' 45'
0.42 − 0.5 cos + 0.08 cos
e−1 e−1
Scaled amplitude in dB
Samples Frequency
238
6.4 Windowing and spectral analysis
§ Rectangular window and corresponding e` = 32
amplitude spectrum
1 for 0 ≤ Y ≤ rR − 1
Ç Y =É
0 otherwise
'?EÅ sin(ΩrR /2)
v5 Ω = e !
Ω⁄2
241
6.4 Windowing and spectral analysis
§ Hann window e` = 64
ÇU644 Y
2=Y
= 0.5 − 0.5cos
r−1
242
6.4 Windowing and spectral analysis - Overview
window function spectrum
Example
§ Measurement signal with 128 points
§ Calculated and spectrum with rectangular rectangular
different window functions
§ Rectangle
§ Hann
§ Hamming
Hann
Hann
Other often used windows:
§ Flattop (Turkey)
§ Kaiser-Bessel- and
§ Blackman-Harris-window
Hamming Hamming
243
6.4 Windowing and spectral analysis - Overview
Peak-width
Suppression of the
highest side lobe § Evaluation is always a compromise:
The higher the side lobe suppression,
side lobe- the wider gets the main peak.
damping
§ In signal processing mostly Hann,
Hamming and Turkey, for special
applications Kaiser-Bessel or Blackman-
window are employed.
Window Suppression of the Side lobe 6 dB-peak-width
function highest side lobe in damping (bins = 2pfs/N)
dB (dB/Oct) § Other windows are rather of
Rectangular -13 -6 1.21 „academic“ interest.
Hann -32 -18 2.00
Hamming -43 -6 1.81
Blackman -58 -18 2.35
244
6.4
Windowing and spectral analysis –
Detection of sine signals
Example
§ We want to analyze the following signal (superimposition of two sine oscillations):
whereas both of the frequencies :9 and :% have to be measured, thus they are unknown.
In the example, r1 = 1 V, r2 = 0.4 V, :9 = 996 Hz, :% = 1032 Hz are chosen.
§ For the successful application of a FFT, it is important to have a „rough idea" of the signals, which have to be
analyzed, and we have to answer these questions:
§ In which frequency domain are the signal components?
§ How close are both frequencies to each other?
§ How big are their amplitudes?
§ Is noise superimposed?
245
6.4
Windowing and spectral analysis –
Detection of sine signals
§ The parameter, which have to be chosen
§ FFT-Parameter: sampling frequency :4 , sampling time )4 , number of samples e,
measuring duration ), frequency resolution ∆: = ä4
§ Window type, window width e`
§ The width of the main peak in the frequency domain depends considerably for all window types on the
window width e` in the time domain.
Ø The bigger e` , the smaller the main peak in the frequency domain.
§ With the choice of the window type, the following characteristics can be controlled:
§ Width of the main peak within the frequency domain (this is different with the same e`
for various window types)
§ Height of the side lobe
246
6.4
Windowing and spectral analysis –
Detection of sine signals
§ Assumption
§ The frequencies, which have to be measured, are approximately in the kHz domain.
§ The difference between both frequencies is at least 20 Hz.
247
6.4 Windowing and spectral analysis –
Detection of sine signals – Results of the spectral analysis
time domain
§ One can clearly see two peaks
of different amplitudes at
Ω9 = 0.782 and
Ω9 = 0.811.
248
6.4 Windowing and spectral analysis
249
6.4 Windowing and spectral analysis –
discrete Hilbert transform
Problem
Measured: real-valued sampling signal ⟹ sought-after: the phase (gradient) and/or envelope of the signal
positive frequencies negative frequencies
real-valued measurement signal Re X(i) Re X(i)
x(n)
FFT 0 N/2 N/2+1 N-1 § Attention: noise through
Im X(i) Im X(i)
0 N sample points N-1 window effects
0 N/2 N/2+1 N-1
§ <′(') is the analytical signal
Complex-valued expanded signal Put all values to zero for <('); it applies
Re x‘(n) Re X(i) Re X(i) < ' = Re <′(')
253
6.5 Time-Frequency Distribution
254
6.5 Spectral analysis of non-stationary signals
§ The Fourier transform gives the spectral composition of a signal. However, it does not give any information
about the temporal relation of this spectral component.
§ Stationary signals consist of spectral components, which do not change over time:
- All spectral components exist over the whole time.
- Temporal information is therefore not necessary.
- The Fourier transform works excellently for stationary signals.
255
6.5 Spectral analysis of non-stationary signals
!$ # = cos 2= 5 #
+ cos 2= 25 #
+ cos(2= 50 #)
256
6.5 Spectral analysis of non-stationary signals
2$ (3)
2! (3)
§ Exact information about which
frequencies occur in the signal
257
6.5 Spectral analysis of non-stationary signals
§ Sine signals and exponential signals
§ are infinitely stretched within time no temporal localization
Dennis Gábor
§ are infinitely small in the frequency domain exact spectral localization (* 1900 in Budapest,
† 1979 in London)
258
6.5 Short-time spectral analysis - Principle
§ Out of the sequence ! Y ,
blocks of the length r (r = 2e ) time domain :
are cut out by a window function
Ç[Y].
Zoom in
Frame/ overlapping
block
259
6.5 Short-time Fourier transform / spectrogram
§ For each block, the FFT is calculated and as a rule, the amount of DFT-coefficients is graphically displayed.
One obtains for each block the so-called short-time Fourier transform (STFT)
7*9
:"
*$%& 7
>4,U, ', l = V < ' − æ Ω æ e
R-#
260
6.5 Short-time Fourier transform / spectrogram
signal shifted
spectrogram of the about # window function
signal !(#)
261
Short-time Fourier transform / spectrogram -
6.5
algorithm
§ Choose a window function of finite length.
§ The window function is placed at the beginning of the signal.
§ Weight the signal with the window function.
§ Calculate the Fourier transform of the weighted signals and store the result.
§ Shift the signal function about a fixed interval to the left.
§ Go back to point 3 until the window function reaches the edge of the signal.
§ In doing so, we obtain for each window position another spectrum.
§ These different spectra contain the spectral information, which belongs to the
individual time interval. This facilitates us with a common display of the signal energy
with respect to time and frequency.
262
6.5 Short-time Fourier transform and spectrogram
263
6.5 Short-time Fourier transform and spectrogram
264
6.5 Spectrogram of the sentence “today is free”
265
6.5 Spectrogram of the sentence “today is free”
Broadband spectrogram
§ High resolution in the time
domain, low resolution in the
frequency domain.
§ Individual glottal stops are well
visible (the vertical curves).
§ The formants (wide horizontal
“bands”) are well to recognize.
They are characteristic for the Formants
sounds, especially for the vocals.
Wideband-sonagramm
266
6.5 Spectrogram
§ One can see the mutual dependency between time and frequency resolution.
§ Either one can achieve the high time resolution at the expense of a limited spectral information, or a high spectral
resolution is bought with time smudging.
§ For the resolution (in terms of separation of two signals) within the time domain ∆) and within
the frequency domain Ɗ, the following applies:
∆ä ( ∆) ≈ 1