170 6. CONTINUOUS-TIME FOURIER TRANSFORM
6.2 NUMERICAL APPROXIMATIONS OF CTFT
Assuming that the signal x.t / is zero for t < 0 and t T , one can approximate the CTFT
integration in Equation (6.1) as follows:
1
Z
1
x.t/e
j!t
dt D
T
Z
0
x.t/e
j!t
dt
N 1
X
nD0
x.n/e
j! n
; (6.3)
where T D N and N is an integer. For sufficiently small , the above summation provides a
close approximation of the CTFT integral. e summation
N 1
P
nD0
x.n/e
j! n
is widely used in
digital signal processing, and MATLAB has a built-in function for it called fft . In a .m file,
if N samples x.n/ are stored in a vector x, then the function call
>> xw=tau*fft(x)
computes
X
!
.k C 1/ D
N 1
X
nD0
x.n/e
j !
k
n
0 k N 1; (6.4)
X.!
k
/
where
!
k
D
(
2k
N
0 k
N
2
2k
N
2
N
2
C 1 k N 1;
(6.5)
with N assumed to be even. e fft function returns the positive frequency samples before
the negative frequency samples. To place the frequency samples in the right order to compute
the inverse transform, the function fftshift can be used as indicated below:
>>xw=fftshift(tau*fft(x))
Note that X.!/ is a vector (actually, a complex vector) of dimension N . X .!/ is complex in
general despite the fact that x.t/ is real-valued. e magnitude of X.!/ is computed using the
function abs and its phase using the function angle .
6.3 EVALUATING PROPERTIES OF CTFT
e example covered in this section provides an implementation of CTFT and its properties.
As mentioned earlier, implementation is carried out only in a discrete fashion. us, to get a
continuous-time representation of a signal, a very small value of time increment t is used. For
example, t D 0:001 means there are 1,000 samples in 1 s, generating a good simulation of a
6.3. EVALUATING PROPERTIES OF CTFT 171
low-frequency continuous signal. However, when working with very high-frequency signals, t
should be decreased further to ensure there are enough samples to adequately simulate them in
a continuous fashion over a specified duration.
L6.1 EVALUATING PROPERTIES OF CTFT EXAMPLE
Let us write a MATLAB code to create two input signals x1 and x2. Set up a case structure by
using mode3 and mode4 for controlling x1 and x2 type, respectively; mode3/mode4 to reflect
0: Rectangular, 1: Triangular, and 2: Exponential. Find the Fourier transform (FT) of these
two signals. Set up another case structure by using mode1 switch_expression to control
the combination method of x1 and x2 in the time domain (0: Linear combination, 1: Convolu-
tion, 2: Multiplication). Finally, set up a case structure by using mode2 switch_expression
to control the combination method in the frequency domain. is operation is performed on
the FT transform of x1 and x2. First, set Pulse width, Time shift, and Time scale as control
parameters. Pulse width controls the number of ones in the pulse, which is used to increase or
decrease the pulse width. Time shift adds zeros before the pulse to provide a time delay. Time
scale is multiplied with the time increment dt to ensure appropriate scaling of the pulse. e
MATLAB function fft can be used to determine the FT of the continuous signal. Com-
bine the signals in the frequency domain and set the combination method (linear combination,
convolution, or multiplication) via the parameter mode2. Compute the FT of the time domain
combinations and the inverse FT of the frequency domain combinations using the functions
fft and ifft . To shift the zero-frequency component to the center of the spectrum, use the
MATLAB function fftshift . Note that it is not necessary to use ffshift. However, its use
allows a better representation of signals in the frequency domain. Finally, determine the magni-
tude and phase of the FT using the functions abs and angle , respectively. Display the input
signals and their combinations using the plot function. Save the MATLAB script using the
name L6_1. e MATLAB code for this example is shown in Figure 6.1 in two pages.
Next, open a new script and write a verification code to evaluate the function L6_1 and
save it as L6_1_testbench. Evaluate the output for different control parameters. See Figure 6.2.
After running L6_1_testbench, follow the steps outlined in L4_1 to generate the C code and
then place it in the shell provided. Figures 6.3 and 6.4 show the app screen on an Android
smartphone as well as the setting parameters.
172 6. CONTINUOUS-TIME FOURIER TRANSFORM
Figure 6.1: L6_1 CTFT and its properties. (Continues.)
6.3. EVALUATING PROPERTIES OF CTFT 173
Figure 6.1: (Continued.) L6_1 CTFT and its properties.
174 6. CONTINUOUS-TIME FOURIER TRANSFORM
Figure 6.2: L6_1_testbench script for verifying CTFT properties.

Get Anywhere-Anytime Signals and Systems Laboratory, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.