Digital Signal Processing Reference
In-Depth Information
Step 3: DFT computation The DFT of the truncated DT sequence g w [ k ]
can now be computed directly from Eq. (12.16). M ATLAB provides a built-in
function fft , which has the calling syntax of
>> G = fft(g);
where g is the signal vector containing the values of the DT sequence g w [ k ]
and G is the computed DFT. Both g and G have a length of N , implying that
an N -point DFT is being taken. The built-in function fft computes the DFT
within the frequency range 0 r ( N 1). Since the DFT is periodic, we can
obtain the DFT within the frequency range ( N 1) / 2 r ( N 1) / 2by
a circular shift of the DFT coefficients. In M ATLAB , this is accomplished by
the fftshift function.
Having computed the DFT, we use Eq. (12.12) to estimate the CTFT of the
original CT decaying exponential signal g ( t ). The M ATLAB code for comput-
ing the CTFT is as follows:
>> f1 = 20; % set sampling rate
>> t1 = 1/f1; % set sampling interval
>> N = 201; k = 0:N-1; % set length of DT sequence to
%N=201
>> g = exp(-0.025*k); % compute the DT sequence
>> g(1) = 0.5; % initialize the first sample
>> G = fft(g); % determine the 201-point DFT
>> G = fftshift(G); % shift the DFT coefficients
>> G = t1*G; % scale DFT such that
% DFT = CTFT
>> dw = 2*pi*f1/N; % CTFT frequency resolution
>> w = -pi*f1:dw:pi*f1-dw; % compute CTFT frequencies
>> stem(w,abs(G)); % plot CTFT magnitude spectrum
>> stem(w,angle(G)); % plot CTFT phase spectrum
The resulting plots are shown in Fig. 12.5, where we have limited the frequency
axis to the range 5 π ≤ ω ≤ 5 π . The magnitude and phase spectra plotted
in Fig. 12.5 are fairly good estimates of the frequency characteristics of the
decaying exponential signal listed in Table 5.3.
Fig. 12.5. Spectral estimation of
decaying exponential signal
g ( t ) = exp(−0.5 t ) u ( t ) using
the DFT in Example 12.6.
(a) Estimated magnitude
spectrum; (b) estimated phase
spectrum.
In Example 12.6, we used the CTFT G ( ω ) to determine the appropriate sampling
rate. In most practical situations, however, the CTFTs are not known and one
2
0.5 p
1.5
0.25 p
0
1
−0.25 p
0.5
−0.5 p
0
−5 p −4 p −3 p
−2 p
p
0
p
2 p
3 p
4 p
5 p
−5 p
−4 p
−3 p
−2 p
p
0
p
2 p
3 p
4 p
5 p
(a)
(b)
Search WWH ::




Custom Search