Dft:Discrete Fourier Transform
Dft:Discrete Fourier Transform
+ x 2 ej
4 T t 4 T t
+ x 3 ej
6 T t 6 T t
j +x 1e
j + x 2e
j + x 3e
x(t)ej
2 T kt
dt for k = 0, 1, 2, 3 . . .
(2)
Now let x[n] be a real-valued discrete-time signal with period=N. Then x[n] can be expanded as: x[n] = X0 +X1 ej N n
2 2
+ X 2 ej N n
4
+... +
X(N 1)/2 ej
N 1 N n
j N n j N n j +X1 e + X2 e + . . . + X( N 1)/2 e
N 1 N n
x[n] = X0
+X1 ej N n
+ X 2 ej N n
+...+
XN 1 ej 2
N 1 N n
(3)
The 1st series is written for odd N ; if N is even, there is an additional term XN/2 ejn . The 2nd series is clearly easier to use, but the analogy to the continuous-time Fourier series is easier to see using the 1 st series. The coecients Xk are computed using the following formula, which is the N-point DFT: Xk = 1 N
N 1
x[n]ej N nk ,
n=0
k = 0, 1, 2 . . . (N 1)
(4)
Parsevals theorem states that we can compute average power in either the time or frequency domains: 1 T
T 0
|x(t)|2 dt =
N 1 n=0
k= N 1
|xk |2 (5)
1 N
|x[n]|2 =
k=0
|Xk |2
since the average power of xk ejt is |xk |2 , and the average power of Xk ejn is |Xk |2 . Comparing the continuous-time and discrete-time Fourier series reveals these similarities:
Both expand the periodic signal x(t) or x[n] in terms of complex exponential functions of time e jt or ejn
In Hertz, these frequencies, called harmonics, are {0, (1/T ), (2/T ) . . .} or {0, (1/N ), (2/N ) . . .}; xk or Xk are computed using an integral over t, or a sum over n like a discretized version of the integral;
Comparing the continuous-time and discrete-time Fourier series reveals these dierences:
The continuous-time Fourier series has an innite number of terms, while the discrete-time Fourier series
has only N terms, since the fastest-oscillating discrete-time sinusoid is cos(n) = (1) n ;
The discrete-time Fourier series treats frequencies < < 0 the same as frequencies < < 2 , since The discrete-time Fourier series coecients do not require evaluation of an integral, just a nite sum (the
B. Simple numerical example Consider the discrete-time periodic signal x[n] = {. . . 24, 8, 12, 16, 24, 8, 12, 18, 24, 8, 12, 16 . . .} By inspection, the period=N=4. The DFT is computed using 1 2 Xk = x[n]ej 4 nk , 4 n=0 Writing this out explicitly for k = 0, 1, 2, 3 yields X0 = X1 = X2 = X3 = 1 (24 + 8 + 12 + 16) = 15 4 1 4 6 1 j 24 + x[2]ej 4 + x[3]ej 4 ) = (24 8j 12 + 16j ) = 3 + 2j 4 (x[0] + x[1]e 4 1 8 12 1 j 44 + x[2]ej 4 + x[3]ej 4 ) = (24 8 + 12 16) = 3 4 (x[0] + x[1]e 4 1 12 18 1 j 64 + x[2]ej 4 + x[3]ej 4 ) = (24 + 8j 12 16j ) = 3 2j 4 (x[0] + x[1]e 4
1 4 (x[0] 3
(6)
k = 0, 1, 2, 3
(7)
(8)
We just computed a 4-point DFT by hand. We could have used Matlab: fft([24 8 12 16],4)/4. The discrete-time Fourier series is
3
x[n] =
k=0
Xk e j
2 4 nk
= 15 + (3 + 2j )ej
2 4 n
+ (3)ej
4 4 n
+ (3 2j )ej
6 4 n
(9)
Plugging n = 0, 1, 2, 3 into this equation does indeed give x[n] = 24, 8, 12, 16, one period of x[n] (try it!). We can also write the discrete-time Fourier series in trigonometric form. Noting that (3 + 2j ) = 3.6ej 34 (rounding o);
o
ejn = cos(n);
ej
6 4 n
= ej
2 4 n
(10)
we can rewrite the above expansion of x[n] in complex exponentials in trigonometric form as x[n] = 15 + 7.2 cos( n + 34o ) + 3 cos(n) 2 (11)
Note that in converting from complex exponential form to trigonometric form, dont double amplitudes of sinusoids at = 0 and = , since there are not two contributing terms. For this x[n], Parsevals theorem states that the average power of x[n] is 1 ((24)2 + (8)2 + (12)2 + (16)2 ) = 260 = |15|2 + |3 + 2j |2 + |3|2 + |3 2j |2 4 The line spectrum of x[n] looks like (remember, its periodic with period 2 ) (12)
3 + 2j 3 2j 3 15 3 + 2j 3
3 2j
3/2
/2
/2 3/2
OK, now go do problem set #6. But what is all of this for? Read on. . . III. Review of continuous-time Fourier series A. Summary of equations Let x(t) be a real-valued periodic signal with period=T, so that x(t) = x(t + T ) for all t. Then x(t) can be expanded in any of the following three Fourier series: x(t) = x0 +x1 ej T
2
t t
+ x 2 ej T
j + x 2e
+ x 3 ej T t + . . .
j + x 3e
6 T t
j T +x 1e
4 T t
+...
x(t) = a0
x(t) = c0
(13)
x(t)ej
2 T kt
dt
for k = 0, 1, 2, 3 . . . for k = 0
x(t)dt = M (x)
and
ej T
mt j 2 T nt
dt
unless m = n unless m = n
5
T 0 T 0 2 sin( 2 T mt) sin( T nt)dt 2 sin( 2 T mt) cos( T nt)dt
0= 0=
kt
equation, all terms except the k th term are zero. This gives us the formula for xk . The formulae for {ck , k } are derived using phasors: a cos(t) + b sin(t) a jb = a2 + b2 ej tan
1
(b/a)
(16)
with the usual caveat that the phase will be o by if a < 0. B. So who needs the DFT? A mathematician would regard this as the end of the matter, as far as computing the Fourier coecients is concerned: Whats the problem? Just plug into any of those integrals in (2). He would be more interested in pathological functions which do not have Fourier series expansions, since they dont satisfy Dirichlet conditions. There was an argument between Fourier and Lagrange at the Paris Academy in 1807 over this. But an engineer would say, I dont have some function x(t). I have a continuous-time recording of Elvis Presley singing. How am I supposed to compute xk =
1 T T 0
elvis(t)ej
2 T kt
dt?
She might consider discretizing the integral into a sum. Choosing a small number , she would discretize t = n, so that 0 = 0 and T = N . The integral then becomes the nite sum 1 T
T
xk =
T 1 N.
elvis(t)ej
0
2 T kt
dt
1 T
N 1
elvis(n)ej
n=0
2 T kn
1 N
N 1
elvis(n)ej N kn
n=0
(17)
since
So she could approximate xk by a nite weighted sum of samples elvis(n) of elvis(t). But
thats only an approximation, and thats not good enough for Elvis! This has us singing Heartbreak Hotel. But we have a Good Luck Charm: the DFT. Amazingly, the nite sum above will be exact, not an approximation, if elvis(t) is bandlimited to 1/(2) Hertz, i.e., elvis(t) has no frequencies at or above 1/(2) Hertz. You should be All Shook Up by this; its what makes DSP possible. And it was discovered by a UM alumnus, Claude Shannon (thats a bust of him outside the west entrance to the EECS building). How can this work? Read on. . . IV. Bandlimited signals and finite Fourier series A. Bandlimited signals Now suppose that x(t) is not only periodic with period=T, but also bandlimited to B Hertz, so that x(t) has no frequencies at or above B Hertz. What does this do for us? Since x(t) is periodic with period=T, its Fourier series consists of sinusoids or complex exponentials at
6
1 2 frequencies f = 0, T , T . . . Hertz. f = 0 is the DC term, f = 1 T k T
is the k th
harmonic (some would say it is the (k 1)th harmonic). There is some integer N such that (N/T ) < B < (N + 1)/T, B = bandwidth of signal (18)
so that B can actually be replaced with any number between these limits. For example, if a signal has a period of T=50 seconds, then The Following Are Equivalent (TFAE):
The signal is bandlimited to 100.005 Hz (N=5000) The signal is bandlimited to 100.015 Hz (N=5000)
In fact, B can be any value between 100 Hz and 100.02 Hz, since the signal has no frequency components between those two harmonics. Without loss of generality (WLOG), we will henceforth split the dierence and assume that (note this implies that what counts for N is the dimensionless product BT ) B = (N + 0.5)/T = bandwidth of signal 2N + 1 = 2BT B. Finite Fourier series The signicance of x(t) being bandlimited is that its Fourier series is nite: x(t) = x0 +x1 ej
2 T t 2
(19)
+ x 2 ej
t
4 T t 4 T t
+...
+ x N ej
N T t
j T +x 1e
j + x 2e
j + . . . + x Ne
N T t
x(t) = a0
x(t) = c0
(20)
No longer are there . . . at the endseach series has a nite number of terms. This means that x(t) is completely specied by (2N + 1) real numbers: {x0 , Re[x1 ] . . . Re[xN ], Im[x1 ] . . . Im[xN ]} or {a0 , a1 . . . aN , b1 . . . bN } or {c0 , c1 . . . cN , 1 . . . N } (21)
If we can somehow come up with those (2N + 1) numbers, we can plug into any of (20) and compute x(t) exactly for any value of t. That is, we have reduced the dimensionality of x(t) from to (2N + 1). But that still doesnt tell us how to come up with those (2N + 1) numbers without computing an integral. What do we do? Read on. . .
V. Sampling theorem for periodic signals A. Sampling Since we only need (2N + 1) numbers, one thing we could do is sample x(t) at (2N + 1) dierent times in a period (note that sampling x(t) at t = 0, T, 2T . . . will only give us a single number!). Lets sample at (2N + 1) equally-spaced times within a period. That is, we sample x(t) at t = (nT )/(2N + 1), Note that n = 2N + 1 would give us t =
n 2N +1 T 2N +1 2N +1 T
n = 0, 1, 2 . . . 2N
(22)
(2N + 1) integers between 0 and (2N ), inclusive. Setting t = in the rst Fourier expansion of (20) gives:
n 2N +1 T
4 T 0
+ x 2 ej
j +x 1e
2 T 0
j + x 2e
4 T 0 4
j + . . . + x Ne
T 2N +1
+x1 ej
T 2 T 2N +1
+ x 2 ej T
+ . . . + x N ej
j +x 1e
2 T T 2N +1
j + x 2e
4
4 T T 2N +1
j + . . . + x Ne
+x1 ej
2 2T T 2N +1
+ x 2 ej T
2T 2N +1
+ . . . + x N ej
N 2T T 2N +1 N 2T T 2N +1
j +x 1e
2 2T T 2N +1
j + x 2e
4
4 2T T 2N +1
j + . . . + x Ne
+x1 ej
2 3T T 2N +1
+ x 2 ej T
3T 2N +1
+ . . . + x N ej
N 3T T 2N +1 N 3T T 2N +1
j +x 1e . . .
2 3T T 2N +1
j + x 2e
4 3T T 2N +1
j + . . . + x Ne
+x1 ej
2 2N T T 2N +1
+ x 2 ej T
4 2N T 2N +1
+ . . . + x N ej
N 2N T T 2N +1 N 2N T T 2N +1
j +x 1e
2 2N T T 2N +1
j + x 2e
4 2N T T 2N +1
j + . . . + x Ne
(23)
(I warned you about the coee. But these are the worst equations.) Dening the samples x[n] of x(t) as x[n] = x(t = (nT )/(2N + 1)) these equations can be rewritten in the much-easier-to-read form x[0] = x0 x[1] = x0
+x1 + . . . + xN + x 1 + . . . + xN
(24)
+x1 ej 2N +1 + x2 ej 2N +1 + . . . + xN ej 2N +1
j 2N +1 j 2N +1 j 2N +1 +x + x + . . . + x 1e 2e Ne
2 4 N
x[2] = x0
+x1 ej 2N +1 + x2 ej 2N +1 + . . . + xN ej 2N +1
2N
8
j 2N +1 j 2N +1 j 2N +1 +x + x + . . . + x 1e 2e Ne . . .
4 8 2N
. . .
. . .
x[2N ] = x0
+x1 ej 2N +1 + x2 ej 2N +1 + . . . + xN ej 2N +1
j 2N +1 j 2N +1 j 2N +1 + x + . . . + x +x 2e Ne 1e
4N 8N 2N 2
4N
8N
2N 2
(25)
which in turn can be written as the (2N + 1) equations (recall xk = x k if x(t) is real-valued)
N
x[n] =
k=N
xk ej 2N +1 nk ,
n = 0, 1, 2 . . . 2N
(26)
While these equations can give you a concussion, they also give you a system of (2N + 1) linear equations in (2N + 1) unknowns. If this system is nonsingular, we should be able to reconstruct the (2N + 1) Fourier
nT coecients {xk , |k | N } from the (2N + 1) samples {x[n] = x( 2N +1 ), n = 0, 1 . . . 2N }.
B. Sampling theorem for periodic signals The signicance of this linear system of equations is that we can compute the (2N + 1) Fourier coecients
nT {xk , |k | N } from the (2N + 1) samples {x[n] = x( 2N +1 ), n = 0, 1 . . . 2N }. That is, we no longer need 1 T T 0
elvis(t)ej
2 T kt
Assume this system of (2N + 1) linear equations in (2N + 1) unknowns is nonsingular. We have: THEOREM: Let x(t) be periodic with period=T seconds and bandlimited to B Hertz, where B has been chosen so that B = (N + 1 2 )/T (we already know we can do this). Then x(t) can
nT be completely reconstructed from its samples {x( 2N +1 ), n = 0, 1 . . . 2N }. Sampling x(t) every 1 2B
seconds (a sampling rate of 2B Hertz) is sucient to reconstruct x(t). Note T is irrelevant! This is quite remarkable, in three dierent ways:
Sampling a signal faster than twice its bandwidth (i.e., twice its maximum frequency) allows us to reconT 2N +1
struct the signal perfectly from its samples! (Recall from (8) that 2N + 1 = 2BT
1 2B .)
The period of the signal is irrelevant; we can let the period T=1 century, if we wish! We can compute the Fourier coecients xk directly from the samples of x(t)no integrals needed!
Claude Shannon actually derived this result for non-periodic signals using a dierent approach, which you will see in EECS 306. But the above argument works for a periodic signal of arbitrarily large period T . This still leaves us with the problem of solving the system of (2N + 1) linear equations in (2N + 1) unknowns. In fact, we can not only solve it, but solve it in closed form. How? Read on. . .
VI. Review of quirks of discrete-time frequency We now make a brief side trip to review quirks of discrete-time frequency. These can be summarized as: Discrete-time frequency is itself periodic with period=2 : If you learn nothing else in EECS 206, learn this! Electric shocks will be given every 2 lectures until this sinks in. What it means is that there is no dierence between a frequency of = /4 and = /4 + 2 (or /4 + 4 , etc.) This follows since A cos(o n + ) = A cos([o + 2 ]n + ) = A cos([o + 4 ]n + ) = . . . In particular, line spectra of discrete-time signals are periodic with period=2 . The fastest possible discrete-time frequency is = : Note fastest is not the same as largest. In continuous time, the higher the frequency, the faster the oscillation. In discrete time, cos(n) = (1) n is the fastest possible oscillation. Increasing frequency above makes the oscillation slow down, until at frequency 2 it stops altogether (recall that = 2 is the same as = 0). To see this, try increasing frequency to greater than by an amount , and note that the oscillation slows down to frequency ( ): A cos([ + ]n + ) = A cos([ ]n ) (28) (27)
A frequency of = + is equivalent to = ( ): This is also a special case of discrete-time frequency being periodic with period 2 . But it will be useful below. VII. Orthogonality and its significance Whats the big deal about orthogonality? Two big deals, actually:
Orthogonality is why there are explicit formulae for computing the coecients of Fourier series, in both
continuous time and discrete time. Otherwise we wouldnt even have the integral formulae.
If two signals are orthogonal, the average power of their sum is the sum of their average powers. This only
works for orthogonal signals! It also is why Parsevals theorem exists. The orthogonality equations (3) are used to derive the formulae (2) for the Fourier coecients in (1). We will use similar equations to derive the DFT. Specically,
N 1
ej N mk ej N nk = 0 unless m = n
k=0
(29)
since
N 1
N 1
ej N mk ej N nk =
k=0 k=0
ej N (mn)k =
ej N (mn)N 1 ej N (mn) 1
2
=0
(30)
10
and ej 2(mn) = 1
N 1 k=0
(31)
0 an indeterminate form like 0 , go back earlier in the problemusually the answer can be seen directly.)
As for average power, note that if M [xy ] = 0, i.e., x and y are orthogonal, then M S [x + y ] = M [|x + y |2 ] = M [(x + y )(x + y ) ] = M [xx ]+ M [yy ]+ M [xy ]+ M [yx ] = M S [x]+ M S [y ] (32) Hence the average power of the sum of orthogonal signals is the sum of their average powers. This leads directly to Parsevals theorem: we can compute the average power of x(t) by summing the average powers of each term of its Fourier series, since these terms are all orthogonal to each other. Thus, 1 T
T 0
|x(t)|2 dt =
2 T kt
|xk |2 = a2 0+
1 2
2 2 (a2 k + bk ) = c0 +
1 2
c2 k
(33)
1 2 is |xk |2 , while the average power of the sinusoid ck cos( 2 T kt k ) is 2 ck (remember the rms value of a sinusoid is its amplitude/ 2, and average power of a sinusoid=(rms)2 ).
VIII. Discrete Fourier Transform (DFT) A. Derivation Now lets return to (26), the system of (2N + 1) linear equations in (2N + 1) unknowns
N
x[n] =
k=N
xk ej 2N +1 nk ,
n = 0, 1, 2 . . . 2N
(34)
Recall from the previous section that negative frequencies < < 0 are equivalent to positive frequencies < < 2 , since frequency is periodic with period=2 . If we dene xk = x 2N +1k = xk2N 1 for (N + 1) k (2N ) (35)
which amounts to taking a periodic extension of {xk }, then the linear system of equations becomes
2N
x[n] =
k=0
xk ej 2N +1 nk ,
n = 0, 1, 2 . . . 2N
(36)
This follows since both ej 2N +1 nk and the now-periodically-extended {xk } are periodic in k with period (2N + 1). So changing the range of summation from [N, N ] to [0, 2N ] still sums the periodic summand over one complete period. We are merely summing the terms in a dierent order; if you believe addition is
11
commutative, then the two sums are the same for all n. Why does changing the index range of k matter? Because if we multiply this latter equation by e j 2N +1 nk , sum from n = 0 to 2N , and use orthogonality equation (29) with N replaced with (2N + 1), we obtain
2 1 x[n]ej 2N +1 nk , 2N + 1 n=0 2
2N
xk =
k = 0, 1, 2 . . . 2N
(37)
This is done algebraically in the Ocial Lecture Notes, but it is easier to see if you dont get bogged down in the algebra. The sum on the right side becomes 0 + 0 + . . . + 0 + (2N + 1)xk + 0 + . . . + 0 = (2N + 1)xk (38)
from which (37) follows. Equation (37) is the (2N + 1)-point DFT of x[n]. Compare it to the N-point DFT and the discretized integral formula from Section 2 (with N replaced with (2N + 1)). The dierence is that the DFT is an exact computation of the Fourier series coecients xk from samples x[n] of x(t). B. Discrete-time Fourier series We can also regard the DFT as an explicit computation of the Fourier coecients of a periodic discrete-time signal x[n], even if this signal did not come from sampling a continuous-time signal. Let x[n] be a periodic signal having period=N (note we have changed from period=2N+1 to period=N; Fourier coecients from xk to Xk ). Then x[n] can be expanded in either of the discrete-time Fourier series x[n] = X0 +X1 ej N n
2 2
+ X 2 ej N n
4
+... +
X(N 1)/2 ej
N 1 N n
j N n j N n j +X1 e + X2 e + . . . + X( N 1)/2 e
N 1 N n
x[n] =
N 1 k=0
Xk ej N nk ,
n = 0, 1, 2 . . . (N 1)
(39)
where the Xk are computed using the N-point DFT of one period of x[n]. For negative indices use
Xk = XN k = Xk
(40)
The rst Fourier series is more physical: we expand the periodic signal x[n] into harmonics having frequencies
k = 2 N , or f = k N,
XN/2 ejn in the series. The fastest discrete-time frequency is = , so we dont need harmonics higher in frequency than = ; they are equivalent to harmonics at lower frequencies. The N-point DFT of a signal contained in a row vector X can be computed in Matlab by fft(X,N)/N.
for |k | (N 1)/2. These formulae are for odd N ; if N is even, there is one more term
X0 =
1 N (x[0]
XN/2 =
1 N (x[0]
+ x[1] + x[2] + x[3] + . . . + x[N 1]); x[1] + x[2] x[3] + . . . x[N 1]) if N is even;
XN k = Xk if x[n] is real-valued.
12
The second half of the {Xk } is the complex conjugate of the rst half, in reverse order and excluding X0 . For example, the 4-point DFT of {24, 8, 12, 16} is {15, 3 + 2j, 3, 3 2j } (we computed this in Section 2).
Use Matlab: fft([24 8 12 16],4)/4. Output: 15,3+2j,3,3-2j; The 4th element is conjugate of the 2nd (exclude the 1st ); The 1st element (DC) is mean of the signal;
1 (24 8 + 12 16) The 3rd element X4/2 = 4
Matlab indexing starts at 1, while DSP indexing starts at 0. This can drive you crazy if you let it! C. Line spectra of discrete-time signals It should always be remembered that line spectra of discrete-time signals are periodic with period=2 . For an N-point DFT, Xk is the line spectrum component at =
2 N k.
+1 NN
1 NN
2/N
N +1 N
2/N
N 1 N
IX. Use of DFT to compute line spectra A. Example: From signal specs to DFT specs Suppose we are given the following signal specs:
Duration: elvis(t) is 4 minutes=240 seconds long Period: Use T=240 seconds (take periodic extension) Bandwidth: elvis(t) has bandwidth 4000 Hz (say)
Sampling rate: Need to sample at 2(4000)=8000 Hz (or faster) Interval: Need to sample every
1 8000
Samples: elvis[n]=elvis(t = n/8000) DFT length: 2N + 1 = 2BT = 2(4000)(240) = 1, 920, 000 (!)
13
In fact, we are usually only in a snippet of elvis(t) a few seconds long Now compute the 1,920,000-point DFT 1 1920000
1919999
Xk =
x[n]ej 1920000 ,
n=0
2nk
k = 0, 1, 2 . . . 1919999
(41)
and plot the line spectrum of elvis[n], which has component Xk at = 2k 1920000 for elvis[n]; f= 8000k 1920000 for elvis(t) (42)
Using Matlab, plot(abs(fftshift(fft(X,1920000)))). fftshift swaps the uppper and lower halves of Xk , so the plot has negative frequencies to the left of positive frequencies. This is really just looking at a dierent period of the spectrum, which remember (one last time!) is periodic with period=2 . B. Example: Spectrum of analytic signal Consider the two-sided decaying exponential x(t) = e|t| , which decays rapidly to zero as |t| . You will
learn in EECS 306 that the actual continuous-frequency spectrum of x(t) is 2/( 2 + 1), i.e., the continuous Fourier transform of e|t| is 2/( 2 + 1). But we can compute that now, numerically, using the DFT.
Duration: e6 = 0.0025 0 support x(t) [6, 6] duration = 12. Period: Use T=12 seconds (take periodic extension). Bandwidth: Assume (unknown) spectrum of e|t| is bandlimited to 8 Hertz. In fact, 8 Hertz 50 |spectrum| = 0.0008 0. But we dont know this; DFT length: Use DFT order 2N + 1 = 2BT = 2(8)(12) = 192-point DFT. 192 sample points in time support [6, 6] sample every 12/192 = 1/16 second. Sampling rate: Note this is Nyquist sampling: Ts = = 1/(2B ) = 1/(2[8 Hertz]) = 1/16 second. 192 sample points in frequency support [8, 8] output line spectrum every 16/192 = 1/12 Hertz. DFT output samples continuous spectrum of x(t) every 1/12 Hertz. Also have to scale DFT output for EECS 306 reasons. Matlab: T=linspace(-6,6,192);X=exp(-abs(T));XK=fftshift(abs(fft(X,192))); F=linspace(-8,8,192);XF=32./(4*pi 2*F. 2+1);plot(F,XF,F,XK,+)
14
40 30 20 10 0 8
C. Example: Spectrum of real-world signal The line spectrum of a train whistle can be computed as follows. Matlab includes the le train.mat, which is a train whistle sampled at 8192 Hertz. The signal was anti-alias ltered to remove all frequencies above 4096 Hertz before sampling, so theres no aliasing. Using a 1-second snippet of it, we have:
Duration: Use a 1-second snippet of train.mat (8192 samples). Period: Use T=1 second (take periodic extension). Bandwidth: 4096 Hertz, assuming that 8192 Hz is the Nyquist sampling rate; DFT length: Use DFT order 2N + 1 = 2BT = 2(4096)(1) = 8192-point DFT. Sampling rate: Nyquist sampling: Ts = = 1/(2B ) = 1/(2[4096 Hertz]) = 1/8192 second. 8192 sample points in frequency support [4096, 4096] output line spectrum every 1 Hertz. load train;X=y(1:8192);plot(-4095:4096,fftshift(abs(fft(X))))
1 0 1 5000
1 0.5 0 5000
dt!
0
1 T T 0
5000
elvis(t)ej
2 T kt
5000