Вы находитесь на странице: 1из 4

KML/LS106/April07 1

EIE312: Linear Systems



LS106: Fourier Analysis of Discrete-time Signals

In this laboratory exercise, you will investigate the discrete-time counterpart of the Fourier analysis for
continuous-time signals and systems. The discrete-time counterpart to the Fourier transform is the
discrete-time Fourier transform (DTFT). Similar to the continuous-time case, the DTFT of a discrete-
time signal is a function of a continuum of frequency. However, the DTFT is always a periodic function
with period 2. For a discrete-time periodic signal, it can be represented by means of the discrete-time
Fourier series (DTFS) in the frequency domain. The form is a function of a finite number of frequencies.
For a time-limited signal, it may be considered as a periodic signal and then represented by the DTFS. It
can be shown that this is equal to the DTFT with the frequency variable evaluated at a finite number of
points. This transform is also called discrete Fourier transform (DFT). As both the time-domain and
frequency-domain representations are discrete in this case, DFT is the transform that is often used in
practice.

The objectives of this laboratory are to
1. Compute the discrete-time Fourier series (DTFS) of a periodic discrete-time signal.
2. Synthesize a signal with its DTFS.
3. Compute the discrete-time Fourier transform (DTFT).
4. System Identification with the DTFT.

1. Computing the Discrete-time Fourier Series
The discrete-time Fourier series (DTFS) is a frequency-domain representation for periodic discrete-time
sequences. For a signal x[n] with fundamental period N, the DTFS synthesis and analysis equations are
given by
| |

=
|
.
|

\
|
=
1
0
2
N
k
n
N
jk
k
e c n x

(1)
and | | .
1
2
1
0
n
N
jk N
n
k
e n x
N
c
|
.
|

\
|

=

=

(2)
(a) Create the following signal x[n] with fundamental period N = 30:
| |

=
=
otherwise. , 0
, 1 , 0 , 1 n
n x
(b) Compute the DTFS of the signal, c
k
, in (2). Plot the real and imaginary parts of c
k
.
(c) From the DTFS, c
k,
computed in (b), synthesize the signal by using equation (1). Plot the real and
imaginary components of the synthesized signal. Discuss the results.

2. Synthesizing signals with the DTFS
This part will give you the practice of using the synthesis and analysis equations for the DTFS as given in
equations (1) and (2).
(a) You are given the following DTFS coefficients of a periodic discrete-time signal with period N = 5:
3
4 4
4
2 2 0
2 , , 1
j j
e c c e c c c = = = = =




The Hong Kong Polytechnic University
Department of Electronic and Information Engineering
KML/LS106/April07 2
(i) Based on the DTFS coefficients, do you expect x[n] to be complex-valued, purely real, or
purely imaginary? Why?
(ii) Using the DTFS coefficients given above, determine the values of c
0
through c
4
and specify a
vector c containing these values.
(iii) Using the vector c of DTFS coefficients and the synthesis equation, define a new vector x
containing one period of the signal x[n] for 0 n 4. Plot the signal x[n] for 0 n 4 using
stem.

(b) You will examine the DTFS representation of the following different square waveforms:
| | , 7 0 , 1
1
= n n x
| |



=
, 15 8 , 0
, 7 0 , 1
2
n
n
n x
| |



=
, 31 8 , 0
, 7 0 , 1
3
n
n
n x
where x
1
[n], x
2
[n], and x
3
[n] have periods of N
1
= 8, N
2
= 16 and N
3
= 32, respectively.
(i) Plot these three signals over the range 0 n 63.
(ii) Compute the DTFS coefficients, c
1
, c
2
, and c
3
, of the signals x
1
[n], x
2
[n], and x
3
[n], respectively.
Generate approximately labelled plots of the magnitude of each of the DTFS coefficient
sequences using abs and stem. What are the DC components of these three signals?
(iii) You will examine how x
3
[n] appears when it is synthesized a few coefficients at a time. Using
the vector c
3
in (ii), define vectors x
3_2
, x
3_8
, x
3_12
and x
3_all
corresponding to the four signals
| |

=
|
.
|

\
|
=
2
2
32
2
2 _ 3
k
n jk
k
e c n x

, | |

=
|
.
|

\
|
=
8
8
32
2
8 _ 3
k
n jk
k
e c n x

,
| |

=
|
.
|

\
|
=
12
12
32
2
12 _ 3
k
n jk
k
e c n x

, and | |

=
|
.
|

\
|
=
16
15
32
2
all _ 3
k
n jk
k
e c n x

.
On the interval 0 n 31, generate the labelled plots using stem for the above four
synthesized signals. Discuss your results. Does the synthesis of this discrete-time square wave
display the Gibbs phenomenon?

3. Computing Samples of the Discrete-Time Fourier Transform (DTFT)
A fundamental difference between the DTFT and the CTFT is that the DTFT is periodic in frequency.
Mathematically, this can be shown by examining the DTFT equation,
) ( ) 1 ( ] [ ] [ ) (
) 2 (

=
+
= = =

j
n
n n j
n
n j
e X e n x e n x X

. (3)
is the continuous frequency variable, which is used for discrete-time signals. To compute the DTFT of
a signal using MATLAB, two issues must be considered. First, if x[n] is an infinite-length signal, the x[n]
must be truncated to a finite-length signal. Second, X() is defined over the continuous variable , but it
can only be computed at a discrete set of frequency samples,
k
. For computational efficiency, the best
set of frequency samples is the set of equally spaced points in the intervals 0 < 2 given by
k
=
2k/N for k = 0, , N 1. For a signal x[n] which is nonzero only for 0 n M 1, those frequency
samples correspond to

=
1
0
/ 2
] [ ) (
M
n
N kn j
e n x X

, k =0, , N 1. (4)
KML/LS106/April07 3
(a) Calculate analytically the DTFT of the rectangular pulse defined by x[n] = u[n] u[n11]. Also
create the vector x containing the nonzero samples of x[n].
(b) Create a vector of N = 100 frequencies containing the frequency samples w = 2*pi*k / N for k =
[0:N1]. Plot |X()| over this range, using the formula derived in (a). Also plot the phase X().
Hint: You may find it useful to define a function to calculate sin(M/2)/sin(/2).

function X = dtftsinc(M,w)
% X = dtftsinc(M,w)
% calculates the function , X = sin(Mw/2)/sin(w/2)
% using selective indexing to avoid division by 0
den = sin(w/2);
num = sin(M*w/2);
X = zeros(size(w));
X(den~=0) = num(den~=0)./den(den~=0);
X(den==0) = M;
return
(c) Rearrange the frequency samples to correspond to the principle period at the DTFT, i.e. - < .
To do this, use w = w - pi. Use the function fft to calculate N = 100 samples of the DTFT of x[n] and
store your result in the vector X. Plot the magnitude and phase of X versus w. Dont forget to use
fftshift to rearrange the DTFT samples in X to match the frequencies in w. How does this plot
compare to your results from (b)?

4. System Identification
Linear time-invariant (LTI) systems have been particularly successful in modeling numerous physical
processes. While an LTI system can often be derived directly from physical laws, in many cases the
model must be deduced from external observations. Such observations might include measuring the
response to a known input x[n]. If the input were an impulse, then the response y[n] would be the impulse
response h[n], which completely determines the LTI system. For most applications, however, one does
not have complete control over the input signal. In this case, the convolution property of the DTFT can
be used to solve for the impulse response. That is, if the DTFTs of the system input and output can be
computed, then
) (
) (
) (

=
X
Y
H (5)
provides the frequency response, which is the DTFT of the impulse response. In MATLAB, the DTFT of
a finite-length signal can be computed at evenly spaced frequencies on the interval 0 < 2 using fft.
Namely, if x is a vector containing x[n] on the interval 0 n N 1, then X=fft(x) is a vector containing
) (
k
X at
k
= 2k/N for 0 k N 1. Since samples of Y() can be computed similarly, H() can be
derived for these frequency samples. The function ifft can then be invoked to compute h[n]. Namely, if
h[n] is a finite-length signal and is nonzero outside the interval 0 n N 1, then ifft(H) returns the
values of h[n] on this interval when H is a vector containing the aforementioned frequency samples of
H().
Suppose that the response of a particular LTI system to the input ] [ ) 4 / 3 ( ] [ n u n x
n
= is
] [
4
3
5
3
] [
2
1
5
2
] [ n u n u n y
n n
|
.
|

\
|
+ |
.
|

\
|
= .
You are to determine the impulse response of this system using fft and ifft.
(a) Store in x and y the values of x[n] and y[n] on the interval 0 n N 1, where N = 64. Plot these
signals to convince yourself that they are essentially equal to zero outside this interval, and thus can
be safely truncated.
(b) Use fft to compute X() and Y() at N = 64 evenly spaced frequencies on the interval 0 < 2.
Plot |X()| and |Y()| versus on the interval 0 < 2.
KML/LS106/April07 4
(c) Compute H() at the same 64 frequency samples. Use ifft to compute h[n] on the interval 0 n N
1.
(d) Because both the system input and output have DTFTs which are ratios of polynomials of e
j
, the
impulse response can also be determined analytically. Determine analytical expressions for Y() and
X(), and then determine analytically the inverse DTFT of Y()/X(). Use this impulse response to
verify the impulse response computed in Part (c).




END

Вам также может понравиться