Vous êtes sur la page 1sur 8

Example 1: Complex Sinusoidal Sum

To solve for the DTFS coecients, we need the following relation

n=<N>
e
jkn
=

N k = N,
0 k = N
for any integer .
Prove that this relation is true. Hint: recall the nite sum formula
N1

n=0
a
n
=
1 a
N
1 a
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 3
Overview of DT Fourier Series Topics
Orthogonality of DT exponential harmonics
DT Fourier Series as a Design Task
Picking the frequencies
Picking the range
Finding the coecients
Example
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 1
Example 1: Workspace
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 4
Motivation
x[n] y[n] h[n] x[n] y[n] H(e
j
)
e
jn
H(e
jn
)e
jn

k
X[k] e
j
k
n

k
X[k] H(e
j
k
n
)e
j
k
n
H(e
j
) = F {h[n]} =

n=
h[n] e
jn
For now, we restrict out attention to DT periodic signals:
x[n + N] = x[n]
Would like to represent x[n] as a sum of complex sinusoids
Why? Gives us insight and simplies computation
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 2
Design Task: Picking the Frequencies
x[n] =

k
X[k] e
j
k
n
We know x[n] is periodic with some fundamental period N
If x[n] is to approximate x[n] accurately, it should also repeat
every N samples
In order for x[n] to be periodic with period N, every complex
sinusoid must also be periodic
Only a harmonic set of complex sinusoids have this property
Thus
k
= k where =
2
N
x[n] =

k
X[k] e
jkn
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 7
DT Periodic Signals Design Task
1 2 0
1
n
-1
x[n]
-2 -3 -4 3 4
x[n] =

1.0 n = 3k
0.5 Otherwise
Suppose we have a DT signal x[n] that we know is periodic
The signal is applied at the input of an LTI system
We would like to estimate the signal as a sum of complex sinusoids
x[n] =

k
X[k] e
j
k
n
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 5
Design Task: Picking the Range
x[n] =

k
X[k] e
jkn
Recall that there are only N distinct complex sinusoids that repeat
every N samples
e
jkn
= e
j(k+N)n
where =
2
N
Thus we can pick the range of the sum so that it includes only
these terms
Typical choices
x[n] =
N1

k=0
X[k] e
jkn
x[n] =
(N1)/2

k=(N1)/2
X[k] e
jkn
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 8
DT Periodic Signals Design Task
x[n] =

k
X[k] e
j
k
n
Here thesymbol is used to indicate that the sum is an
approximation (estimate) of x[n]
Enables us to calculate the system output easily
Must pick
The frequencies
k
The range of the sum

k
The coecients X[k]
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 6
Design Task: Coecient Optimization
x[n] =

k=<N>
X[k] e
jkn
MSE =
1
N

n=<N>
|x[n] x[n]|
2
Solving for the optimal coecients is dicult
However, suppose that an optimal solution exists such that
MSE = 0
If such a solution exists, we know the sum of errors will also be
zero
0 =

n=<N>
x[n] x[n]
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 11
Equivalent Expressions for Exponential Sums
x[n] =

k
X[k] e
jkn
Since only N of the harmonics are distinct, we may truncate the sum
so that it only contains only N distinct terms. It does not matter
which set of N terms are used.
x[n] =
N1

k=0
X[k] e
jkn
=
N1+

k=
X[k] e
jkn
=

k=<N>
X[k] e
jkn
Note the new notation:

k=<N>
X[k] e
jkn

N+

k=1+
X[k] e
jkn
for any
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 9
Design Task: Solve for the Coecients
0 =

n=<N>
x[n]e
jn

n=<N>
x[n]e
jn

n=<N>
x[n]e
jn
=

n=<N>
x[n]e
jn

n=<N>
x[n]e
jn
=

n=<N>


k=<N>
X[k] e
jkn

e
jn
=

k=<N>
X[k]

n=<N>
e
jkn
e
jn
=

k=<N>
X[k]

n=<N>
e
j(k)n
=

k=<N>
X[k] (N[k ])
= X[]N
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 12
Design Task: Picking the Coecients
x[n] =

k=<N>
X[k] e
jkn
MSE =
1
N

n=<N>
|x[n] x[n]|
2
We would like to pick the coecients X[k] so that x[n] is as close
to x[n] as possible
But what is close?
One measure of the dierence between two signals is the mean
squared error (MSE)
There are other measures, but this is a convenient one because we
can dierentiate it
Since the signal is periodic, the MSE is calculated over a single
fundamental period of N consecutive samples
How do we pick the coecients X[k] to minimize the MSE?
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 10
Further DTFS Observations & Comments
x[n] =

k=<N>
X[k] e
jkn
X[k] =
1
N

n=<N>
x[n]e
jkn
The DTFS transform is special because both sums are nite
This permits us to calculate the DTFS exactly with computers
(e.g. MATLAB) and microprocessors
Later we will see how the DTFS is used to compute the other
3 transforms
The Fourier series representation of signals is useful for LTI system
design and analysis because we know how LTI systems aect
sinusoidal signals
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 15
Design Task: Optimal Coecients
Thus, the coecient of the th complex sinusoid that minimize the
MSE is
X[] =
1
N

n=<N>
x[n]e
jn
With more algebra, you should be able to show that these
coecients result in MSE = 0!
Thus, x[n] = x[n]
This means any DT periodic signal can be exactly represented as a
sum of N complex sinusoidal harmonics
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 13
Example 2: Pulse
m 0
1
n
x[n]
-m N -N
What type of symmetry does the signal have? Find the DT Fourier
series coecients. Plot the coecient spectrum, partial sums of the
Fourier series components, and the MSE versus number of coecients.
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 16
DTFS Observations
x[n] =

k=<N>
X[k] e
jkn
X[k] =
1
N

n=<N>
x[n]e
jkn
The rst equation is called the synthesis equation
The second equation is called the analysis equation
The coecients X[k] are called the spectral coecients or
Fourier series coecients of x[n]
We denote the relationship of x[n] and X[k] by
x[n]
FS
X[k]
Both are complete representations of the signal: if we know one,
we can compute the other
X[k] is a function of frequency (k)
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 14
Example 2: Partial Fourier Series
15 10 5 0 5 10 15
0.6
0.4
0.2
0
0.2
0.4
0.6
0.8
1
1.2
Time (samples)
Partial Fourier Series Approximation (k=0)
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 19
Example 2: Workspace
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 17
Example 2: Partial Fourier Series
15 10 5 0 5 10 15
0.6
0.4
0.2
0
0.2
0.4
0.6
0.8
1
1.2
Time (samples)
Partial Fourier Series Approximation (k=1 to 1)
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 20
Example 2: Coecient Spectrum
25 20 15 10 5 0 5 10 15 20 25
0.2
0.1
0
0.1
0.2
0.3
0.4
0.5
kth (harmonic)
X
[
k
]
DiscreteTime Fourier Series Coefficients X[k]
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 18
Example 2: Partial Fourier Series
15 10 5 0 5 10 15
0.6
0.4
0.2
0
0.2
0.4
0.6
0.8
1
1.2
Time (samples)
Partial Fourier Series Approximation (k=4 to 4)
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 23
Example 2: Partial Fourier Series
15 10 5 0 5 10 15
0.6
0.4
0.2
0
0.2
0.4
0.6
0.8
1
1.2
Time (samples)
Partial Fourier Series Approximation (k=2 to 2)
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 21
Example 2: Partial Fourier Series
15 10 5 0 5 10 15
0.6
0.4
0.2
0
0.2
0.4
0.6
0.8
1
1.2
Time (samples)
Fourier Series Synthesis (k=5 to 5)
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 24
Example 2: Partial Fourier Series
15 10 5 0 5 10 15
0.6
0.4
0.2
0
0.2
0.4
0.6
0.8
1
1.2
Time (samples)
Partial Fourier Series Approximation (k=3 to 3)
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 22
Example 2: MATLAB Code Continued
NP = 0:(N-1)/2;
k = 1:N-1;
a(1) = (1/N)*(m+1/2)/(1/2);
a(k+1) = (1/N)*sin(w*k*(m+1/2))./sin(w*k/2);
tm = mod(n,N);
x = 1*(tm<=m) + 1*(tm>=N-m);
for c1 = 1:length(NP),
figure;
hold on;
xd = zeros(size(n));
xc = zeros(size(t));
for c2 = 1:c1,
k = c2-1;
if k==0,
xpd = a(c2)*exp(j*k*w*n);
xpc = a(c2)*exp(j*k*w*t);
else
xpd = a(c2)*exp(j*k*w*n) + conj(a(c2))*exp(-j*k*w*n);
xpc = a(c2)*exp(j*k*w*t) + conj(a(c2))*exp(-j*k*w*t);
end;
h = plot(t,xpc);
set(h,Color,[0.0 0.6 0.0]);
set(h,LineWidth,0.2);
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 27
Example 2: Mean Squared Error
1 2 3 4 5 6 7 8 9 10 11
0
0.05
0.1
0.15
0.2
0.25
Coefficients
M
S
E
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 25
Example 2: MATLAB Code Continued
h = plot(n,xpd,.);
set(h,Color,[0.0 0.6 0.0]);
set(h,MarkerSize,6);
xd = xd + xpd;
xc = xc + xpc;
end;
h = plot(t,xc,k);
set(h,LineWidth,0.4);
h = stem(n,x,r);
set(h(1),Marker,.);
set(h(1),MarkerSize,11);
set(h(2),LineWidth,1.4);
h = stem(n,xd,b);
set(h(1),Marker,.);
set(h(1),MarkerSize,8);
set(h(2),LineWidth,0.8);
xlabel(Time (samples));
st = sprintf(Fourier Series Approximation (k=%d to %d),-(c1-1),c1-1);
title(st);
xlim([min(t) max(t)]);
ylim([-0.70 1.20]);
end;
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 28
Example 2: MATLAB Code
N = 11;
m = 2;
T = 11;
w = 2*pi/N;
n = (-15:15);
t = (-15:0.01:15);
figure(1);
K = -25:25;
for c1 = 1:length(K),
k = K(c1);
if k==0,
a(c1) = (1/N)*(m+1/2)/(1/2);
else
a(c1) = (1/N)*sin(w*k*(m+1/2))./sin(w*k/2);
end;
end;
h = stem(K,a);
set(h,Color,[0 0.6 0]);
set(h(1),Marker,.);
set(h(1),MarkerSize,10);
set(h(2),LineWidth,1.0);
xlabel(kth (harmonic));
ylabel(a_k);
title(Discrete-Time Fourier Series Coefficients a_k);
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 26
Example 3: Workspace
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 31
DTFS Terminology
x[n] =

k=<N>
X[k] e
jkn
X[k] =
1
N

n=<N>
x[n]e
jkn
X[k] is complex-valued in general
The function |X[k]| is called the magnitude spectrum of x[n]
The function arg X[k] is called the phase spectrum of x[n]
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 29
Summary
A nite sum of complex sinusoids can represent any DT periodic
signal!
The coecients of these sinusoids are useful for signal analysis
and LTI system design
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 32
Example 3: Impulse Train
Find THE DTFS coecients of a periodic impulse train,
x[n] =

=
[n N]
J. McNames Portland State University ECE 223 DT Fourier Series Ver. 1.04 30

Vous aimerez peut-être aussi