Frequency Domain Representation

advertisement
Chapter 7
ft
Frequency Domain
Representation
D
ra
In this chapter, we explore further the frequency domain representation of signals. This representation is important to really grasp the nature of signals. It
is used to build filters. It is also used in OFDM communications systems (see
Section 9.7). The content of radio bands can be visualized and analyzed with
real-time frequency domain representations.
Fourier analysis is a tool for looking at the frequency domain representation
of a signal. Hereafter, it is called the analyzed signal. The main statement is that
any periodic signal can be analyzed and decomposed into a fundamental sinusoid
and a series of harmonic sinusoids. Not surprisingly, the frequencies of the
analyzed signal and fundamental sinusoid are the same. The harmonic sinusoids
are at frequencies that are integral multiples of the frequency of the fundamental
sinusoid. The sum of the fundamental and harmonic sinusoids yields the original
signal. The fundamental sinusoid, as well as each harmonic sinusoid, has an
amplitude reflecting its weight in the composition of the analyzed signal. Fourier
analysis resolves the peak amplitudes of the fundamental sinusoid and harmonic
sinusoids. In the sequel, we look at Fourier analysis from the intuitive, formal
and implementation angles.
7.1
Fourier Analysis Intuition
Fourier analysis uses products of signals to measure the presence of a sinusoid
into an analyzed signal. The products are calculated as a function of time t.
Given two time-domain represented signals r(t) and s(t), their product as a
function of time is r(t) · s(t). Figure 7.1 illustrates the idea. The first plot
represents an analyzed signal over a period of one second. It turns out to
be a two-Hz signal modeled with equation cos(2π · 2t). It is assumed that
the same pattern is reproduced repeatedly. Indeed, Fourier analysis assumes
that the analyzed signal is periodic and that the analysis is conducted on data
97
© 2015 Michel Barbeau
Software Defined Radio
0
−1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Time (s)
Product of analyzed and a 1 Hz sinusoid
Amplitude (V)
0.9
1
ft
1
0
−1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Time (s)
Product of analyzed signal and 2 Hz sinusoid
0.9
1
0.5
0.6
0.7
0.8
0.9
Time (s)
Product of analyzed signal and 2 Hz quadrature sinusoid
1
1
0.5
ra
Amplitude (V)
Amplitude (V)
Amplitude (V)
A 2 Hz analyzed signal
1
0
0
0.1
0.2
0.3
0.4
−0.5
0
0.1
0.2
0.3
0.4
0.5
0
0.5
0.6
Time (s)
0.7
0.8
0.9
1
D
Figure 7.1: The top plot is an analyzed signal at two Hz. The second plot is
the product of the analyzed signal with a one-Hz sinusoid. The third plot is the
product of the analyzed signal with a two-Hz sinusoid. The analyzed signal and
sinusoid are in-phase. The fourth plot is the product of the analyzed signal and
a two-Hz quadrature sinusoid.
representing one period of the signal. Corresponding to a period of one second
is a fundamental sinusoid at one Hz, modeled with equation cos(2π · 1t). The
analysis then first tests the presence of a one Hz sinusoid in the analyzed signal.
The second plot corresponds to the product of the analyzed signal with a oneHz sinusoid. The integration of the curve, i.e., the sum of the areas under the
98
CHAPTER 7. FREQUENCY DOMAIN REPRESENTATION
© 2015 Michel Barbeau
Software Defined Radio
curve, is null
1
Z
cos(2π · 2t) · cos(2π · 1t)dt = 0.
0
ft
Positive areas are cancelled by equal size negative areas. This is interpreted as
the absence of a one-Hz sinusoid in the analyzed signal. Because of the null
integration, the analyzed signal and on-Hz sinusoid are said to be orthogonal
signals.
The third plot results from the product of the analyzed signal and a two-Hz
sinusoid, modeled with equation cos(2π · 2t). The integration of the curve yields
0.5. Indeed, we have
Z 1
1
cos2 (2π · 2t)dt = .
2
0
ra
This non null value confirms the presence of a two-Hz sinusoid in the analyzed
signal. Note that the result of the integration is half the peak amplitude of
the tested sinusoid. Section 7.2 explains why. The fourth plot represents the
product of the analyzed signal with a two-Hz quadrature sinusoid, modeled with
equation sin(2π · 2t). The average amplitude is null as well as the integration of
the signal
Z 1
cos(2π · 2t) · sin(2π · 2t)dt = 0.
0
The analyzed signal and two-Hz quadrature sinusoid are orthogonal. In fact, to
measure the presence of a frequency in an analyzed signal, Fourier analysis calculates the sum of the product of the analyzed signal with an in-phase sinusoid
and its quadrature. More precisely, the measure of the presence of frequency f
in an analyzed signal is the sum of the product of the analyzed signal with a
complex sinusoid at frequency f .
D
Exercise 7.1
Formally demonstrate the correctness of the three integrals displayed in this
section.
7.2
Formal Fourier Analysis
The Discrete Fourier Transform (DFT) is a formal technique for translating a
signal from a time domain representation into a frequency domain representation. The DFT takes in a series of samples x0 , x1 , . . . , xN −1 , where N is a
CHAPTER 7. FREQUENCY DOMAIN REPRESENTATION
99
© 2015 Michel Barbeau
Software Defined Radio
positive integer. It is assumed that the samples represent one period of a periodic analyzed signal. The output consists of N coefficients X0 , X1 , . . . , XN −1 .
For k = 0, 1, . . . , N − 1
N
−1
X
−j2πnk
(7.1)
Xk =
xn · e N .
n=0
ft
Using Euler equivalence (Equation 1.2), Equation 7.1 is rewritten as
!
!#
"
N
−1
X
2πnk
2πnk
− j sin
.
Xk =
xn · cos
N
N
n=0
ra
The samples are correlated with a complex sinusoid at negative frequency k/N .
The coefficients X0 , X1 , . . . , XN −1 are also called the FFT bins. As a complex
number, each coefficient captures the information about a sinusoid potentially
contained in the analyzed signal. The frequency of the sinusoid represented by
coefficient Xk is
k2π
radians/sample.
N
If the sampling frequency is fs sps, in Hz it is
kfs
Hz.
N
X0 is the coefficient for DC (zero Hz). X1 is the coefficient for the fundamental
sinusoid at 2π/N radians/sample or fs /N Hz. According to the Nyquist criterion, at fs sps the frequency of the highest sinusoid that can be represented is
lower than fs /2 Hz, which corresponds to coefficient XN/2 . Hence, the analysis
needs only to calculate the coefficients with indices k = 0, 1, . . . , N/2. The corresponding frequencies are ±kfs /N Hz. The number Xk is a complex a + jb.
Its magnitude |Xk | is
p
|Xk | = a2 + b2 Volts.
D
The peak amplitude of frequency ±kfs /N Hz is |Xk |/N Volts. Its phase is
φ = arctan
b
radians.
a
The quadrant of the angle can be determined by looking at the signs of a and
b (see Exercise 9.3).
Given the coefficients Xk , with k = 0, 1, . . . , N − 1, it is possible to go from
a frequency domain representation to a time domain representation using the
Inverse Discrete Fourier Transform (IDFT)
xk =
N −1
−j2πnk
1 X
Xn · e N .
N n=0
Equation 7.2 is called a Fourier series.
100
CHAPTER 7. FREQUENCY DOMAIN REPRESENTATION
(7.2)
Software Defined Radio
© 2015 Michel Barbeau
Exercise 7.2
7.3
ft
Assuming that the period of an analyzed signal is represented by 1024 samples,
determine the number of multiplications and additions performed by a DFT.
Fourier Analysis Implementation
ra
There are many redundant calculations in the DFT and IDTF. This problem
has been investigated and resulted in the Fast Fourier Transform (FFT). The
complexity of the calculations is greatly simplified by exploiting the symmetries
and eliminating the redundant calculations of the DFT. All signal processing
packages include an implementation of the FFT. It is also possible to go back
to a time domain representation from a frequency domain representation using
the Inverse Fast Fourier Transform (IFFT).
Figure 7.2 pictures the result of a FFT. Note that there are four lines. There
are two lines at -50 and +50 Hz, with amplitude one and a half Volts, and two
more lines at -150 and +150 Hz, with amplitude four Volts. The figure was
produced by the following Octave script:
1
2
3
4
5
6
7
8
9
D
10
% Fast Fourier Transform
% −−−−−−−−−−−−−−−−−−−−−−
% Set the number of samples
N=1024;
% Create an array of N samples
time=[0:N−1]*1/N;
% Create a signal with frequencies f1 and f2
f1=50; % Hz
f2=150; % Hz
signal=3*sin(2*pi*f1*time)+8*sin(2*pi*f2*time);
% N−bin DFT
y=fft(signal,N)/N;
% Generate the range of frequencies
f=[−N/2:N/2];
% Plot the two−sided amplitude spectrum
plot(f,abs([y(N/2+1:N),y(1:N/2+1)]));
% Annotations
ylabel('Amplitude (V)');
xlabel('Frequency (Hz)');
grid on;
11
12
13
14
15
16
17
18
19
20
By design, the FFT requires that the number of samples is a power of two. In
this example, the analyzed signal is represented by a period of 1024 samples,
lines 4 and 6. The analyzed signal comprises sinusoids at frequencies 50 and 150
Hz and is constructed on lines 8 to 10. Line 12 uses the Octave built-in function
CHAPTER 7. FREQUENCY DOMAIN REPRESENTATION
101
© 2015 Michel Barbeau
Software Defined Radio
4
3.5
2.5
ft
Amplitude (V)
3
2
1.5
1
ra
0.5
0
−600
−400
−200
0
Frequency (Hz)
200
400
600
Figure 7.2: The spectrum obtained with a FFT on a signal comprising sinusoids
at 50 and 150 Hz and represented by 1024 samples.
FFT to compute the coefficients of the Fourier series. The FFT returns a vector
of complex numbers of length N . Actually, the coefficients X0 , X1 , . . . , XN −1
are calculated. The mathematical equivalence
|X−N/2 | = |XN/2 |, . . . , |X−1 | = |XN −1 |
D
is used in the sequel of the script. The coefficients are divided by N , to obtain
the corresponding integration values, and assigned to variable y. The range
of frequencies is determined on line 14. Assuming that the sampling rate is
1024 sps, the frequency domain ranges from −N/2 to +N/2 Hz, i.e., from
-512 to +512 Hz. On line 16, the magnitude of the array items in y are calculated using the Octave function abs. When x is complex, abs(x) returns
the magnitude of the number. Note that the array items y(N/2+1:N) correspond to X−N/2 /N, . . . , X−1 /N while the array items y(1:N/2+1) correspond
to X0 /N, . . . , XN/2 /N .
In this example, the input signal is real only, the imaginary part is absent.
In such a case, the negative-frequency part of the spectrum is a mirror image
of the positive-frequency part of the spectrum. The diagram is redundant. The
energy is split between the two parts. Amplitudes of peaks in Figure 7.2 are
102
CHAPTER 7. FREQUENCY DOMAIN REPRESENTATION
© 2015 Michel Barbeau
Software Defined Radio
Complex samples, f1 is negative, f2 positive
8
7
7
6
6
5
5
4
4
3
3
ft
Amplitude (V)
Complex samples, both f1 and f2 positive
8
2
2
1
1
0
−600 −400 −200
0
200
Frequency (Hz)
400
600
0
−600 −400 −200
0
200
Frequency (Hz)
400
600
ra
Figure 7.3: DFT.
half the amplitudes of the sinusoids of the analyzed signal. An option is to
plot solely the positive part and multiply by two the magnitude of array items
y(1:N) on line 16.
When the input samples are complex with non null imaginary parts, there
is no redundancy in the FFT analysis. To convert the example to complex
samples, line 10 is rewritten as:
signal=3*exp(i*2*pi*f1*time)+8*exp(i*2*pi*f2*time);
D
Left of Figure 7.3 shows the corresponding result. Right of Figure 7.3 shows
the analysis of the spectrum when frequency f1 is made negative, line 10 is
rewritten as:
signal=3*exp(−i*2*pi*f1*time)+8*exp(i*2*pi*f2*time);
Exercise 7.3
Add random noise to the spectrum display example of Figure 7.2.
CHAPTER 7. FREQUENCY DOMAIN REPRESENTATION
103
© 2015 Michel Barbeau
7.4
Software Defined Radio
Further Reading
D
ra
ft
The book Digital Signal Processing Using Matlab contains more details about
the DFT, FFT and IFFT with scripts that can easily be adapted to Octave [29].
104
CHAPTER 7. FREQUENCY DOMAIN REPRESENTATION
Download