4 up` version (compExpAndSpecRep318_4up)

advertisement
Exponentials
CMPT 318: Lecture 5
Complex Exponentials, Spectrum Representation
• The exponential is typically used to describe the
natural growth or decay of a system’s state.
Tamara Smyth, tamaras@cs.sfu.ca
School of Computing Science,
Simon Fraser University
• An exponential is defined as
January 23, 2006
x(t) = e−t/τ
where e = 2.7182... and τ is the characteristic
time constant of the exponential where at time
t = τ , the function will equal 1/e. That is, τ is the
time it takes to decay by 1/e.
• In room acoustics, “t60” or T60, is defined as the
time to decay by 60 dB.
• Though this function may, at first, seem very different
from a sinusoid, both functions are aspects of a
slightly more complicated function.
1
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
Complex numbers
2
Complex Numbers cont.
• A complex number can be drawn as a vector, where
the tip of the vector is at the point (x, y), where x is
the horizontal coordinate, or the real part, and y is
the vertical coordinate, or the imaginary part.
• Complex numbers provides a system for manipulating
rotating vectors, and allows us to represent the
geometric effects of common digital signal processing
operations, like filtering, in algebraic form.
=m{z}
• In rectangular (or Cartesian) form, the complex
number z is defined by the notation
z = x + jy = rejθ
r
z = x + jy.
θ
• The part without the j is called the real part, and
the part with the j is called the imaginary part.
<e{z}
Figure 1: Cartesian and polar representations of complex numbers in the complex plane.
• We may now refer to the x and y axes as the realand imaginary-axes, respectively.
• A multiplication by j may be seen as an operation
meaning “rotate counterclockwise 90◦ or π/2”.
• Two successive rotations by π/2 bring us to the
negative real axis, that is, j 2 = −1. From this we see
√
j = −1.
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
3
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
4
Polar Form
Euler’s Formula
• A complex number may also be represented in polar
form
z = rejθ .
• Recall from our previous section on sinusoids that the
projection of a rotating sinusoid on the x− and y−
axes, traces out a cosine and a sine function
respectively.
where the vector is defined by its
• From this we can see how Euler’s famous formula for
the complex exponential was obtained:
1. Length r
2. Direction θ
ejθ = cos θ + j sin θ,
• The length of the vector is also called the magnitude
of z (denoted |z|) and the angle with the real axis is
called the argument of z (denoted arg z).
valid for any point (cos θ, sin θ) on a circle of radius
one (1).
• Using trigonometric identities and the Pythagorean
theorem, we can compute:
• Euler’s formula can be further generalized to be valid
for any complex number z:
1. The Cartesian coordinates(x, y) from the polar
variables r∠θ:
z = rejθ = r cos θ + jr sin θ.
• Though called “complex”, these number usually
simplify calculations considerably—particularly in the
case of multiplication and division.
x = r cos θ and y = r sin θ
2. The polar coordinates from the Cartesian:
y p
r = (x2 + y 2) and θ = arctan
x
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
5
Complex Exponential Signals
6
Real and Complex Exponential Signals
How does the Complex Exponential Signal
compare to the real sinusoid?
• The complex exponential signal (or complex sinusoid
is defined as
x(t) = Aej(ω0t+φ).
• As seen from Euler’s formula, the sinusoid given by
A cos(ω0t + φ) is the real part of the complex
exponential signal. That is,
• It may be expressed in Cartesian form using Euler’s
formula:
x(t) = Aej(ω0t+φ)
= A cos(ω0t + φ) + jA sin(ω0t + φ).
A cos(ω0t + φ) = re{Aej(ω0t+φ)}.
• As with the real sinusoid,
– A is the amplitude given by |x(t)|
q
|x(t)| , re2{x(t)} + im2{x(t)}
q
≡ A2(cos2(ωt + φ) + sin2(ωt + φ))
≡ A for all t
(since cos2(ωt + φ) + sin2(ωt + φ) = 1).
– φ is the initial phase
– ω0 is the frequency in rad/sec
– ω0t + φ is the instantaneous phase, also denoted
arg x(t).
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
• Recall that sinusoids can be represented by the sum
of in-phase and phase-quadrature components.
Complex exponentials allow us to represent this
algebraically:
=
=
=
=
=
7
A cos(ω0t + φ) = re{Aej(ω0t+φ)}
re{Aej(φ+ω0t)}
Are{ejφejω0t}
Are{(cos φ + j sin φ) (cos(ω0t) + j sin(ω0t))}
Are{cos φ cos(ω0t) − sin φ sin(ω0t)
+j(cos φ sin(ω0t) + sin φ cos(ω0t))}
A cos φ cos(ω0t) − A sin φ sin(ω0t).
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
8
Inverse Euler Formulas
Complex Conjugate
• The complex conjugate z of a complex number
z = x + jy is given by
• The inverse Euler formulas allow us to write the
cosine and sine function in terms of complex
exponentials:
ejθ + e−jθ
cos θ =
,
2
and
ejθ − e−jθ
sin θ =
.
2j
• This can be shown by adding and subtracting two
complex exponentials with the same frequency but
opposite in sign,
ejθ + e−jθ = cos θ + j sin θ + cos θ − j sin θ
= 2 cos θ,
and
ejθ − e−jθ = cos θ + j sin θ − cos θ + j sin θ
= 2j sin θ.
z = x − jy.
• A real cosine can be represented in the complex plane
as the sum of two complex rotating vectors that are
complex conjugates of each other.
Complex Plane
1
0.8
0.6
Imaginary Part
0.4
0.2
0
−0.2
−0.4
−0.6
−0.8
−1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
Real Part
• The negative frequencies that arise from the complex
exponential representation of the signal, will greatly
simplify the task of signal analysis and spectrum
representation.
• A real cosine signal is, therefore, actually composed
of two complex exponential signals: one with a
positive frequency and one with a negative
frequency.
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
9
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
10
Complex Sinusoids
Analytic Signals
• Every real sinusoid consists of an equal contribution
of positive and negative frequency components.
The real sinusoid x(t) = A cos(ωt + φ) can be converted
to a positive frequency complex sinusoid
z(t) = A exp[j(ωt + φ)] to create an analytic signal, by
generating a phase quadrature component
y(t) = A sin(ωt + φ) to serve as the imaginary part.
• If X(ω) denotes the spectrum of the real signal x(t),
then
|X(−ω)| = |X(ω)|
• A complex sinusoid ejωt consists of one frequency ω,
while the real sinusoid sin(ωk t) consists of two (2)
frequencies ω and −ω.
• It is easier therefore, and more common, to use the
“less complicated” complex sinusoid when doing
signal processing.
1. Consider the positive and negative frequency
components of a real sinusoid at frequency ω0:
x+ , ejω0t
x− , e−jω0t.
2. Apply a phase shift of −π/2 to the positive-frequency
component and of π/2 to the negative-frequency
component:
• Given, a real signal, the negative frequencies are
usually “filtered out” to produce an analytic signal, a
signal which has no negative frequency components.
y+ = e−jπ/2ejω0t = −jejω0t
y− = ejπ/2e−jω0t = je−jω0t.
3. Form a new complex signal by adding them together:
z+(t) , x+(t) + jy+(t) = ejω0t − j 2ejω0t = 2ejω0t
z−(t) , x−(t) + jy−(t) = e−jω0t + j 2e−jω0t = 0.
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
11
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
12
Hilbert Transform Filters
Complex Amplitude or Phasor
• For more complicated signals (which are the sum of
sinusoids), a filter, called a Hilbert Transform Filter is
used to shift each sinusoidal component by a quarter
cycle.
• When two complex numbers are multiplied, their
magnitudes multiply and their angles add:
• When a real signal x(t) and its Hilbert transform
y(t) = Ht{x} are used to form a new complex signal
• This is true also of the complex exponential signal. If
the complex number X = Aejφ is multiplied by the
complex valued function ejω0t, we obtain
z(t) = x(t) + jy(t)
r1ejθ1 r2ejθ2 = r1r2ej(θ1+θ2).
x(t) = Xejω0t = Aejφejω0t = Aej(ω0t+φ) .
the signal z(t) is the (complex) analytic signal
corresponding to the real signal x(t).
• The complex number X is referred to as the
complex amplitude, a polar representation of the
amplitude and the initial phase of the complex
exponential signal.
• Example: Suppose you have a signal
x(t) = A(t) cos(ωt).
How do you obtain A(t) without knowing ω?
Ans: Use the Hilbert tranform to generate the
analytic signal
• The complex amplitude is also called a phasor as it
can be represented graphically as a vector in the
complex plane.
z(t) ≈ A(t)ejωt ,
and then take the absolute value
A(t) = |z(t)|.
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
13
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
14
Spectrum Representation
Spectrum Representation cont.
• Recall that summing sinusoids of the same frequency
but arbitrary amplitudes and phases produces a new
single sinusoid of the same frequency.
• Using inverse Euler, this signal may be represented as
N X
Xk jωk t X k −jωk t
x(t) = A0 +
.
e
+
e
2
2
k=1
• Summing several sinusoids of different frequencies will
produce a waveform that is no longer purely
sinusoidal.
• Every signal therefore, can be expressed as a linear
combination of complex sinusoids.
• The spectrum of a signal is a graphical
representation of the frequency components it
contains and their complex amplitudes.
• If a signal is the sum of N sinusoids, the spectrum
will be composed of 2N + 1 complex amplitudes and
2N + 1 complex exponentials of a certain frequency.
• Consider a signal that is the sum of N sinusoids of
arbitrary amplitudes, phases, AND frequencies:
x(t) = A0 +
N
X
10
7ejπ/3
Ak cos(ωk t + φk )
7e−jπ/3
4e−jπ/2
4ejπ/2
k=1
• Figure shows the spectrum of a signal with N = 2
components.
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
15
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
16
Why are phasors important?
Linear Time Invariant Systems
• Linear Time Invariant (LTI) systems perform only four
(4) operations on a signal: copying, scaling, delaying,
adding.
• The output of an LTI system therefore is always a
linear combination of delayed copies of the input
signal(s).
• Notice, the “carrier term” x(n) = ejωnT can be
factored out to obtain
N
X
y(n) =
gix(n − di)
i=1
y(n) =
i=1
=
N
X
giejωnT e−jwdiT
i=1
gix(n − di)
= x(n)
N
X
gie−jwdiT ,
i=1
showing an LTI system can be reduced to a
calculation involving only the sum phasors.
where gi is the ith weighting factor, di is the ith
delay, and
x(n) = ejωnT .
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
giej[w(n−di)T ]
i=1
• In a discrete time system, any linear combination of
delayed copies of a complex sinusoid may be
expressed as
N
X
=
N
X
• Since every signal can be expressed as a linear
combination of complex sinusoids, this analysis can be
applied to any signal by expanding the signal into its
weighted sum of complex sinusoids (by expressing it
as an inverse Fourier Transform).
17
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
18
Signals as Vectors
Projection, Inner Product and the DFT
• For the Discrete Fourier Transform (DFT), all signals
and spectra are length N . A length N sequence x
can be denoted x(n), n = 0, 1, ...N − 1, where x(n)
may be real or complex.
• The coefficient of projection of a signal y onto
another signal x can be thought of as a measure of
how much x is present in y, and is computed using
the inner product hx, yi.
• We may regard x as a vector x in an N dimensional
vector space. That is, each sample x(n) is regarded
as a coordinate in that space.
• Mathematically therefore, a vector x is a single point
in N-space, represented by a list of coordinates
(x(0), x(1), x(2), ..., x(N − 1).
4
x = (2, 3)
• One signal x(·) is projected onto another signal y(·)
using an inner product defined by
N
−1
X
hx, yi ,
x(n)y(n)
n=0
• The vectors (signals) x and y are said to be
orthogonal if hx, yi = 0. That is
x ⊥ y ⇔ hx, yi = 0.
x = (1,1)
1
3
2
1
−1
1
2
3
y = (1,−1)
Figure 3: Two orthogonal vectors for N = 2
1
2
3
4
.
Figure 2: A length 2 signal plotted in 2D space.
hx, yi = 1 · 1 + 1 · (−1) = 0.
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
19
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
20
Orthogonality of Sinusoids
DFT Sinusoids
• Sinusoids are orthogonal at different frequencies if
their durations are infinite.
• The N th roots of unity are plotted below for N = 8.
ejω2 T = ej4π/N = ejπ/2 = j
• For length N sampled sinusoidal segments,
orthogonality holds for the harmonics of the sampling
rate divided by N, that is for frequencies
ejω1 T = ej2π/N = ejπ/4
fs
fk = k , k = 0, 1, 2, 3, ..., N − 1.
N
• These are the only frequencies that have a whole
number of periods in N samples.
[ejωk T ]N = [ejk2π/N ]N = ejk2π = 1.
21
• Taking successively higher integer powers of the root
ejωk T on the unit circle, generates samples of the kth
DFT sinusoid.
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
22
Final DFT and IDFT
• Recall, one signal y(·) is projected onto another
signal x(·) using an inner product defined by
N
−1
X
hy, xi ,
y(n)x(n)
• The DFT is most often written
N
−1
X
2πkn
X(ωk ) ,
x(n)e−j N , k = 0, 1, 2..., N − 1.
n=0
n=0
• If x(n) is a sampled, unit amplitude, zero-phase,
complex sinusoid,
x(n) = ejwk nT , n = 0, 1, . . . , N − 1,
then the inner product computes the Discrete Fourier
Transform (DFT).
N
−1
X
hy, xi ,
y(n)x(n)
=
• The sampled sinusoids corresponding to the N roots
of unity are given by (ejωk T )n = ej2πkn/N , and are
used by the DFT.
• Since each sinusoid is of a different frequency and
each is a harmonic of the sampling rate divided by N ,
the DFT sinusoids are orthogonal.
DFT
n=0
N
−1
X
• The complex sinusoids corresponding to the
frequencies fk are
2π
sk (n) , ejωk nT , ωk , k fs, k = 0, 1, 2, ..., N − 1.
N
These sinusoids are generated by the N th roots of
unity in the complex plane, so called since
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
ejω0 T = 1
• The IDFT is normally written
N −1
2πkn
1 X
x(n) =
X(ωk )ej N .
N
k=0
y(n)e−jwk nT
n=0
, DFTk (y) , Y (ωk )
• Y (ωk ), the DFT at frequency ωk , is a measure of the
amplitude and phase of the complex sinusoid which is
present in the input signal x at that frequency.
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
23
CMPT 318: Fundamentals of Computerized Sound: Lecture 5
24
Download