Summary: In this lab you will explore DSP FFT implementations and power spectral density (PSD) estimators. You will also learn how to write DSP code in C and the trade-offs between writing in C versus assembly.
Note: Your browser may not currently support MathML. See our browser support page for additional details. You can always view the correct math in the PDF version.
In this lab you are going to apply the Fast Fourier Transform (FFT) to analyze the spectral content of an input signal in real time. You will also explore algorithms that estimate a stationary random signal's Power Spectral Density (PSD). Finally, you will be introduced to using the C environment and code optimization in a practical application. This knowledge will be applied in optimizing a reference implementation of a PSD estimator.
First, samples of the power spectrum of a deterministic signal will be calculated via the magnitude squared of the FFT of the windowed signal. You will transform a 1024-sample block of input data and send the power spectrum to the output for display on the oscilloscope. After computing the FFT of a 1024-sample block of input data, you will then compute the squared magnitude of the sampled spectrum and send it to the output for display on the oscilloscope. In contrast to the systems you have implemented in the previous labs, the FFT is an algorithm that operates on blocks of samples at a time. In order to operate on blocks of samples, you will need to use interrupts to halt processing so that samples can be transferred.
The FFT can be used to analyze the spectral content of a signal. Recall that the FFT is an efficient algorithm for computing the Discrete Fourier Transform (DFT), a frequency-sampled version of the DTFT.
DFT:
Your implementation will include windowing of the input data prior to the FFT computation. This is simple a point-by-point multiplication of the input with an analysis window. As you will explore in the prelab exercises, the choice of window affects the shape of the resulting spectrum.
A block diagram of the spectrum analyzer you will implement in the lab, including the required input and ouput locations, is depicted in Figure 1.
![]() |
Second, you will generate a colored, psuedo-noise (PN) sequence as
input to the power spectrum algorithm. The noise sequence will be
generated with a linear feedback shift register, whose operation is
as shown in Figure 2. This PN generator is simply a
shift-register and an XOR gate. Bits 0, 2, and 15 of the shift-register
are XORed together and the result is shifted into the lowest bit of
the register. This lowest bit is the output of the PN generator,
and the highest bit is discarded in the shift process.
The LSB is used to generate a
value of
| Pseudo-Noise Generator |
|---|
![]() |
The direct-power-spectrum (DPS) algorithm outlined above is insufficient for estimating the PSD of a stationary noise signal because the variance of the estimated PSD is proportional to the value of the actual PSD. For the third part of this lab you will try to reduce the variance of the PSD estimate by windowing the autocorrelation of the noise signal and computing the fft.
The autocorrelation of a sequence is the correlation of the sequence with itself:
For random signals, the autocorrelation here is an estimate
of the actual autocorrelation.
As
A good empirical characterization of a random process requires sufficient data, and both of the PSD-estimation algorithms defined above can be extended to accomodate more data. There is one caveat, however: many real-world processes are modeled as short-time stationary processes (non-stationary models are hard to deal with), so there is a practical limit to how much data is available for a PSD estimate. Additional data is added to the direct-PSD estimation algorithm by adding multiple spectra together, thereby smoothing the PSD estimate. Additional data is added to the windowed-autocorrelation method by computing the autocorrelation of the total data set before windowing. You will explore the windowed-autocorrelation method on the DSP.
A second objective of this lab exercise is to introduce the TMS320C5510 C environment in a practical DSP application. The C environment provides a fast and convenient way to implement a DSP system using C and assembly modules. You will also learn how to optimize a program and when to use C or assembly. In future labs, the benefits of using the C environment will become clear as larger systems are developed.
In previous labs, processing was done on a sample-by-sample basis. In the next two labs, we will be working on 1024-blocks of input/data. The buffering has already been setup, leaving the user the task of adding code that processes the data.
"Real-Time DSP with MATLAB"