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

DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING

COLLEGE OF ENGINEERING AND APPLIED SCIENCES

Spectral Analysis Implementations:


A Comparative Analysis of the Windowed Precombiner
Odd-Frequency Fourier Transform, Windowed Dual-Real
Radix-2 Fast Fourier Transform and Non-Windowed FFT

Draft #1: 18 March 2002

Draft #2: 17 May 2002

Dr. Bradley J. Bazuin


Assistant Professor

Technical Report: TN05022002BJB

Abstract
Application of the Fourier Transform for analyzing the time waveforms of sensor data is
a well-established method for characterizing the behavior of industrial equipment. The
implementation can take on a number of different structures based on the desired
performance. This analysis compares various implementations and develops an operation
minimizing approach for observing spectral frequency bins with excellent resolution and
minimal operations.

Disclaimer
This is a technical report generated by the author as a record of personal research interest and activity.
Western Michigan University makes no representation that the material contained in this report is correct,
error free or complete in any or all respects. Thus, Western Michigan University, it’s faculty, it’s
administration, or students make no recommendation for the use of said material and take no responsibility
for such usage. Therefore, persons or organizations who choose to use this material do so at their own risk.
1 Fourier Transform Processing
Desired frequency response for sensors having a bandpass filter response characteristics
is shown in Fig. 1. The radio frequency (RF) or intermediate frequency (IF) passband is
centered after demodulation at one quarter of the sampling rate (fs/4). The filter
transitions bands are then allowed to “evenly” change through the remainder of the
available Nyquist sampling spectral region and alias or fold back into the non-passband
transition region. As a goal, the “folded” transition band should be sufficiently attenuated
by the time it enters the RF or IF passband as to be inconsequential, preferably with
70 dB or more attenuation. As a note, these spectral characteristics may be centered at
any multiple of fs/2 if an ADC converter capable of wide bandwidth input and
subsampling is used.
IF Passband
fs = ADC clock rate
0 dB

Filter
Transition
Band

"Folded" Alias
-80 dB
Component

0 fs/4 fs/2 3fs/4 fs

Figure 1. ADC Input Passband

To process the spectral response of an input, whether downconverted from an RF or IF or


directly sampled at baseband, the discrete Fourier Transform (DFT) is used. The DFT for
sampled data system is defined as
N 1
X k    xn   WNnk (1)
n 0

where


WNnk  exp  i 2nk
N

If the number of samples, N, in a data set is a power of 2, then a Fast Fourier Transform
(FFT) algorithm can be employed. While Equ. 1 requires N complex by real multiplies
and accumulations for every frequency bin computed (nominally N), a butterfly FFT
algorithm could perform the same function in order N  log 2  N  operations, a significant
savings. This is one example of algorithm and implementation manipulations that can
greatly reduce the computation burden of spectral analysis and/or provide additional
frequency and dynamic range resolution.

Spectral Analysis Imp. 2 B.J. Bazuin


One frequently used alternate implementation for spectral analysis uses a frequency
shifted version of the DFT previously shown. The frequency is shifted by exactly one-
half of a frequency bin resulting in the following transform
N 1
 
X k    xn   WN
n k1
2
(2)
n 0

This is commonly referred to as an Odd-Frequency Fourier transform or OFFT. The


locations of the spectral bins or frequency analysis cells that result from an FFT or OFFT
are shown in Fig. 2. The OFFT can be directly computed using an FFT by premultiplying
the real-data sequence by a complex value and then performing an FFT.

 
N 1
X k    W2nN  xn   WNnk (3)
n 0

0 fs

Digital IF

0 1 2 N-3 N-2 N-1

FFT
Analysis Cells

0 1 2 N-3 N-2 N-1

OFFT
Analysis Cells

Figure 2. Uniformly Spaced Analysis Cells

When performing a DFT or OFFT on real, band-limited signal spectral symmetry exists
that can greatly reduce the number of bins that need to be computed. For real input data,
the resulting spectrum have a real output that is symmetric and an imaginary output that
is anti-symmetric. The mathematical derivation of this property follows.

1.1 FFT Symmetry for Real Data

The symmetry of an FFT is defined between K and N-k frequency bins. Taking the
original FFT equation and substituting a change in variables for the frequency k we have
N 1 N 1
X N  k    WNn  N  k   xn    WNnN  WN nk  xn  (4)
n 0 n 0

Spectral Analysis Imp. 3 B.J. Bazuin


which can be simplified as
N 1
X  N  k   1  WN nk  xn  (5)
n 0

Taking the conjugate of both sides of the equation result in

 N 1  N 1
conjX  N  k   conj  WNnk  xn    WNnk  xn  (6)
 n 0  n 0

and

X  N  k   X k 
*
(7)

Thus, the conjugate symmetry of a real-input FFT has been established

As a result of this symmetry, a logical extension is to suggest that either only half of the
frequency bins need to be computed (0 to N/2) or that there is some other method of
utilizing the “unnecessary” processing. Because the bins 0 and N/2 are unique in the
processing, algorithms to only process the “first half” of the bins are not very efficient.

Additional efficiency can be derived by processing two real-data sequences


simultaneously, one input as a real sequence and the second input as a purely imaginary
sequence. The Dual-Real algorithm computes
N 1
Z k    WNnk   xn   i  y n 
n 0 (8)
Z k   X k   i  Y k 

and uses the symmetries to resolved two distinct spectral outputs as

X 0  real Z 0


(9)
Y 0  imag Z 0

real  X k   real Z k   Z  N  k  2
(10)
real Y k   imag Z k   Z  N  k  2

imag  X k   imag Z k   Z  N  k  2
(11)
imag Y k    real Z k   Z  N  k  2

X N 2  real Z  N 2
(12)
Y  N 2  imag Z N 2

Spectral Analysis Imp. 4 B.J. Bazuin


1.2 OFFT Symmetry for Real Data

The symmetry of an OFFT is defined between K and N-k-1 frequency bins. Taking the
original OFFT equation and substituting a change in variables for the frequency k we
have
N 1
X N  k  1   xn   W2nN  WNn  N  k 1 (13)
n 0

which can be simplified as


N 1
X N  k  1   xn   W2nN  WNnN  WN nk  WN n (14)
n 0

N 1
X N  k  1   xn   W2Nn  1  WN nk (15)
n 0

Taking the conjugate of both sides of the equation result in

 N 1  N 1
conj X  N  k  1  conj  xn   W2Nn  WN nk    xn   W2nN  WNnk (16)
 n 0  n 0

and

(17)
X *  N  k  1  X k 

Thus, the symmetry of a real-input OFFT has been established

With this symmetry, only half of the frequencies bins need to be computed (0 to N/2-1).
While the FFT required bins 0 to N/2, the OFFT requires exactly half and can be further
manipulated to form an efficient implementation. Assume that we break the real data into
two sets, the first N/2 and the second N/2 as follows
N 2 1 N 2 1
X k    xn   W2nN  WNnk   xn  N 2  W  n N 2
2N  WNn  N 2 k (18)
n 0 n 0

by explicitly expanding the exponentials as


N 2 1 N 2 1
X k    xn   W2nN  WNnk   xn  N 2  W N
4N  W2nN  W2NkN  WNnk (19)
n 0 n 0

collecting similar terms

Spectral Analysis Imp. 5 B.J. Bazuin


N 2 1
X k   W n
2N 
 WNnk  xn   xn  N 2   W4NN  W2NkN  (20)
n 0

and simplifying results in

 
N 2 1
X k   W  WNnk  xn   i   1  xn  N 2  (21)
n k
2N
n 0

Based on the symmetrical properties, only one half the points need to be computed. In
this case, the even points result in

 
N 2 1
X 2k   W  WN2 nk  xn   i  xn  N 2    1
2k
n
2N
(22)
n 0

N 2 1
X 2k   W n
2N  WNnk2   xn   i  xn  N 2  (23)
n 0

Restructuring this result in

 W  W  xn   i  xn  N 2


N 2 1
X 2k   nk
N 2
n
2N
(24)
n 0

This equation allows the spectral bins of an OFFT to be computed by combining the first
half of the real data with the negative imaginary second half of the real data,
premultiplying by the complex coefficients previously defined and performing an N/2
length DFT or FFT.

To “fill in” every other bin, conjugate symmetry is applied to the “second half” of the
spectral results as follows.

(25)
X 2k  1  X *  N  2k  2

1.3 Operation Count Comparison

For this implementation, the operation counts of the derived algorithms for real input data
and Radix-2 FFT implementation of the DFTs can be derived. In general, the FFT of a
complex data input sequence required

5  N  log 2  N  (26)

real multiplies and real additions.

The dual-real FFT algorithm performs one FFT for two real input data sets and then has
additional operations to separate the two results. The resulting operations per transform is
approximately

Spectral Analysis Imp. 6 B.J. Bazuin


5  N  log 2  N  2 N
 (27)
2 2

2.5  N  log 2  N   N (28)

This technique provides useful savings over a direct FFT implementation.

For an OFFT, data processing uses the first half of the samples as real data and the
second half as negative imaginary data. Next, a complex multiplication is done on the
N/2 points followed by an N/2 point complex FFT. Finally, data reordering and
conjugation is required to finalize the result.

The total operations required involve N/2 complex multiplies and N/2 point FFT or the
total of adds, subtracts and multiplies of

6  N  5  N  log 2 N
2 2 2
  (29)

3  N  2.5  N  log 2  N   2.5  N (30)

2.5  N  log 2  N   0.5  N (31)

This technique provides additional savings over the dual-real FFT implementation.

The OFFT provides an additional advantage when implemented on a fixed point or block
floating point processor (fixed point mantissas with one exponent for the data block). The
dual-real algorithm combines two distinct data sequences. As a consequence, high
dynamic range in one sequence can dominate the numerical precision of the computation
and reduce the resulting resolution of the second sequence. For the OFFT, only one data
set is being processed, so other data sequences will have no effect on the precision of the
computation.

Spectral Analysis Imp. 7 B.J. Bazuin


2 Windowed Fourier Transform Processing
When performing a DFT, the spectral resolution of signals closely spaced in frequency is
based on the size, N, of the samples processed by the transform. For higher frequency
resolution, a larger sample set is needed, resulting in more closely spaced frequency bins.
An alternate approach that provides better frequency resolution involves windowing the
input data.

From transform theory, multiplication in the time domain is the equivalent of convolution
in the spectral domain. By considering a sample set of data as being collected by a
rectangular window function, the resulting convolved spectrum “smears” the correct
spectral response by the transform of an all-one, rectangular function (a sinc function
with a spectral width dependent upon the number of samples). By applying a data
window that is not all-ones the spectral “smearing” can be shaped to provide improved
frequency resolution, greatly reducing the impact of adjacent or near frequency bin
energy.

The equation for a windowed DFT is


N 1
X k    wn   xn   WNnk (32)
n 0

while a windowed odd-frequency Fourier transform is


N 1
 
X k    wn   xn   WN
n k 1
2
(33)
n 0

As expected, the direct implementation is simply performed by multiplying each sample


point by a corresponding window coefficient.

2.1 Windowed Precombiner Transformation

In all transform processing, energy from adjacent spectral bins will leak in and be with
any single bin. If there are sufficient spectral bins, there may be a sufficient number of
bins between frequencies that must be resolved, but this may require very large
transforms. After processing, the unwanted spectral bins can be ignored and those
appropriately spaced can be retained and analyzed. By employing a window the spacing
of useable bins can be closer, but some bins will still not be of interest.

A mathematical technique exists to support this concept, where the equivalent of a large
windowed sample set transform is processed but only regularly spaced bins at a desired
spacing are maintained. A mathematical derivation based on keeping every m-th bin of a
mN length data set and using symmetry to compute every other spectral bin follows

Spectral Analysis Imp. 8 B.J. Bazuin


 m
 m  mN 1 n  2 mk  
    wn   xn   WmN
2
X  2mk (34)
 2  n 0

N 1  m
 m 2 n  2 mk  
X  2mk   
 2
 wn  xn  W
n 0
mN
 2
 ...

 s 1 N 2 1  m
n  2 mk  
  wn   xn   W mN
 2
 ... (35)
n  s N
2

mN 1  m
n  2 mk  
  wn  xn   W mN
 2

n   2 m 1 N
2

N 1  m
 m 2 n  2 mk  
X  2mk   
 2
 wn  xn  W
n 0
mN
 2
 ...

 2  xn  s  N 2  W  
N 1  m
2 n  s N 2 mk  
2 
 n 0
w n sN mN
2
 ... (36)

 2  xn  2m  1  N 2  W  
N 1  m
2 n   2 m 1 N 2 mk  
2 
  w n  2m  1  N mN
2

n 0

2 m 1 n  s N 2  2 mk  m2  


   
N 1
 m 2
X  2mk   
 2

n 0
  w n  s  2  x n  s  2  WmN
 s 0
N N 

(37)

 
   n 

m

  w n  s  2  x n  s  2  WmN  WmN2  
N 1 N N 2 mkn

 m 2 2 m 1
X  2mk   
 2
   (38)
 s 0  
m
n 0 2 mks N s N 
   WmN 2  WmN 2 2


   
N 1
 m 2
2 m 1 s
X  2mk   
 2

n 0
  w n  s  N 2  x n  s  N 2  WN  W2 N  W1  W4 
 s 0
nk
2
n sk


(39)

   
N 1
 m 2  2 m 1 
X  2mk     WNnk   W2nN     i   w n  s  N  x n  s  N 
s
(40)
 2  s 0 2 2
n 0 2
 

The above equation must be solved. Note that the equation in braces either adds or
subtracts certain weighted and multiplied samples while assigning the real values as
either real or complex elements for further processing. The bracketed multiplication is a
“twiddle factor” premultiplication prior to an N/2 point FFT as indicated by the
summation and FFT “twiddle factor”. To form the N/2 spectral elements not directly
calculated, use conjugate symmetry to access the appropriate bin results.

Spectral Analysis Imp. 9 B.J. Bazuin


 m  3m 
X  2k  1  m    X *  mN  2km   (41)
 2  2 

(42)
X 2k  1  X *  N  2k  2

The resulting signal processing is similar to a windowed OFFT transformation previously


derived. In general, this equation shows that:
 the data samples are point-wise windowed as expected,
 the data is separated into N/2 length segments, where the 6th and 2nd are subtracted
from the addition of the 4th and 0th blocks and used as the real input and the 7th
and 3rd are subtracted from the addition of the 5th and 1st blocks and used as the
negative imaginary data in a data precombination process,
 the transform performed on the precombined data is equivalent to a real N-point
OFFT performed with an N/2-point FFT, and
 as complex data is being processed all the result bins define unique spectral
content.

For m=4, the total operations required involve 4N real multiplies, 2N real data
subtractions, an N/2 length complex multiplication and an N/2 length FFT

6 N N N
4 N  2 N   5   log 2   (43)
2 2 2

4  2  3  2.5  N  2.5  N  log 2  N  (44)


2

6.5  N  2.5  N  log 2  N  (45)

As a comparison, a 4N length windowed FFT would require 4N real multiplies and a dual
real 4N length FFT requiring

4  N  2.5  4 N   log 2 4 N   4 N  (46)

4  4  10  N  10  N  log 2 N  (47)

18  N  10  N  log 2  N  (48)

From this analysis, the windowed precombiner has a significant advantage over direct
data processing by nearly a factor of four and allows an N/2 length FFT to provide the
bin resolution capability of a 4N length equivalent transformation.

Spectral Analysis Imp. 10 B.J. Bazuin


3 MATLAB Simulations
A MATLAB simulation of the precombiner has been created to validate and demonstrate
the processing. For demonstration purposes, an N=512-point equivalent DFT was
selected with the spectral decimation (m) by a factor of 4. Therefore, the equivalent dual-
real FFT size is 2048-points, the OFFT precombiner FFT size is 256-points and the
window or filter is 2048-points.

The software simulation generates a desired window function or filter. A special window
function was selected for the demonstration to provide a smooth equivalent spectral
response for a precombiner bin with a 3dB rolloff at the band edges, greater than 55 dB
attenuation at the center of the adjacent bin and greater than 75 dB attenuation from all
other bins. The equivalent spectral plot of the filter is shown in Fig. 3 assuming a signal
sample rate of 25.6 Msps resulting in OFFT spectral bins of 50 kHz bandwidth. The band
edge is at 25 kHz and adjacent bin centers are located at 75 kHz, 125 kHz, etc.
Filter interpolated from QMF_weights6:
Order = 2048
0

-10

-20

-30
Magnitude (dB)

-40

-50

-60

-70

-80

-90

0 50 100 150 200 250 300 350 400


Frquency (kHz)

Figure 3. Window Function Spectral Response.

Next the number of signals that are present in the spectrum is selected with their relative
signal-to-white-noise rations (SWNR). The signal time samples are then defined based on
the type of waveform desired. A list of available waveforms is shown in Table 1.
Random noise can be added to the combined input signal as desired.

Spectral Analysis Imp. 11 B.J. Bazuin


Table 1. Precombiner Simulation Waveform Selections
Select Signal #1 Test Waveform
1) Random Samples Test
2) Random Sine Wave Test
3) Random Two Tone Test
4) Random Block Spectrum with a Notch
5) Fixed Comb Generator
6) Random Comb Generator
7) Random CPFSK Signal
8) AM PTT Signal
9) Frequency Ramp/Chirp
10) Impulse Response
11) Random RC-CPFSK Signal [default]
12) Alternating RC-CPFSK
13) DSB AM Radio
14) DSB TVI
15) Random Two Tone Test w/ Gain Difference
16) Multi-Dwell CPFSK with pulse shaping
17) Pulse
18) BPSK
19) BPSK with pulse shaping
20) Spread Spectrum
Input the Test Signal: [11] 9
Apply Spectral Inversion (1-yes/0-no): [0]

For this test, two 100 dB SWNR signals are generated. The first is a linear frequency
ramp or chirp (type 9) and the second is a sine wave (type 2). The chirp signals ramps
through 6 frequency bins during the test while the sine wave is placed in another part of
the processed signal spectrum. A complete test signal description as output from the
simulation is provided in Table 2.

Table 2. Simulation Waveform Descriptions


CHAN_TSG: 21-May-2002
TDM #1: Complex Linear Frequency Test
TDM #2: Complex Sine Wave

Signal AOA SWNR max. SINR


1 5.10 100.00 -0.00
2 214.60 100.00 -0.00
TDM #1:
Complex Linear Frequency Test
SWNR = 100 dB.
Start= 24 and Stop= 30

TDM #2:
Complex Sine Wave
SWNR = 100 dB.
Tone = 128 Phase = 293.834 deg

Signal AOA SWNR max. SINR


1 5.10 100.00 -0.00
2 214.60 100.00 -0.00
The signal 1 adjusted power is -8.65438 dB.
The signal 2 adjusted power is -8.65438 dB.

The antenna 1 noise power is -108.649 dB.

Spectral Analysis Imp. 12 B.J. Bazuin


The composite test signal is processed based on three distinct operations. First, a
windowed precombiner transformation is performed on overlapping segments of the data.
One transformation is generated for every N/2 points. Under normal operation one
transform would be performed every 4N samples. This rate has been chosen as it allows
each spectral bin output to be available at the Nyquist sampling rate for the data bin
equivalent bandwidth. The second transformation performed is a full length windowed
FFT of size 4N samples, again performed every N/2 sample points. This result once
decimated should be identical to the windowed precombiner approach. The third
transformation is an N sample FFT without any windowing. This transformation provides
the same spectral bin size as the windowed precombiner transformation but has no
windowing.

For each of these transformations a 3-D plot of the resulting power spectrum versus time
has been generated as shown in Fig. 4. The sine wave spectrum can be seen as a constant
signal power across all bins in time. The frequency ramp or chirp is readily visible in the
windowed precombiner as each successive frequency bin is entered and exited and less so
in the windowed FFT and equivalent non-windowed FFT. The windowed FFT has
considerable overlap in frequency bins since the nominal window bandwidth is 50 kHz
and the bin spacing is 12.5 kHz. If the frequency bins were decimated by a factor of 4
(saving only every 4th bin after processing), an identical plot to that of the windowed
precombiner results. Finally, the non-windowed FFT spectrum shows the considerable
adjacent bin energy present when a simple FFT is performed.

Another means of performance analysis involves observing all the spectral bins
simultaneously across the time samples as shown in Fig. 5 for the windowed precombiner
and non-windowed FFT. These plots clearly show the frequency ramps signal power in
time as it moves through adjacent bins. The windowed precombiner provides excellent
resolution while the FFT clearly peaks at bin centers but has poor transition bands to
adjacent bins and significant adjacent channel responses. The sine wave spectrum can be
readily observed as a constant signal in both plots. The simulated signal power levels for
the sine wave and frequency ramp are identical. The FFT plot clearly shows this as the
frequency ramp power peaks at the center of each bin at an equivalent power to the sine
wave. In the windowed precombiner, the sine wave level is below the frequency bin
peaks. For this simulation, the sine wave frequency is half way between two frequency
bins resulting in two adjacent bins each containing 50% of the signal power or –3 dB
from the bin center peaks.

The MATLAB code that performs the specific signal performance demonstration and
analysis is provided in the following sections, including the OFFT_ANALYSIS and
OFFT functions that are specifically required for correct operation.

Spectral Analysis Imp. 13 B.J. Bazuin


Windowed Precombiner Transform Windowed FFT Transform
FFT Length 256 FFT Length 2048

FFT Transform
FFT Length 512

Figure 4. Spectral Transformation in Time.


The signal power is shown on the z-axis, spectral bins across the lower left axis and
individual transformation times across the lower right axis.

0 0

-10 -10

-20 -20

-30 -30

-40 -40

-50 -50

-60 -60

-70 -70

-80 -80

-90 -90

-100 -100
0 20 40 60 80 100 120 140 160 180 200 0 20 40 60 80 100 120 140 160 180 200

Windowed Precombiner Transform FFT Transform


FFT Length 256 FFT Length 512

Figure 5. Individual Bin Spectral Power in Time.


The signal power is shown on the y-axis, spectral bins are independently plotted, and
individual transformation time is shown in the x-axis.

Spectral Analysis Imp. 14 B.J. Bazuin


3.1 PRECOMBINE_TEST Routine
% Precombiner Test Simulation
%

%
% Author:
% Bradley J. Bazuin, Ph.D.
% 17 May 2002
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear

load chan_parms

Filter_size=DFT_size*poly_taps;
TDM_proc = 0;
test=1;
plot_mesh=1;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Load filter type %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% load chan_filt_data

load chan_filt_data
fprintf(sfilter)
fprintf('\n')

Afilter=filter1/sum(filter1);
Sfilter=flipud(Afilter);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Load Test Signal %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% load CHANTSG_data

load CHANTSG_data
fprintf(sTSG)
fprintf(sTSG_title)
fprintf(sTSG_label)
sTSG_data=[sTSG sTSG_title sTSG_label];

[num_samples,num_cols] = size(signal);

fprintf('There are %g signal data samples.\n',num_samples)

blocks=fix(num_samples/DFT_size);
fprintf('\nThere are %g processing blocks.\n\n',blocks)

t_start=clock;
flops(0)

Spectral Analysis Imp. 15 B.J. Bazuin


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Analysis Algorithm %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
channels=zeros(DFT_size,2*blocks,num_cols);
channels2=zeros(poly_taps*DFT_size,2*blocks,num_cols);
channels3=zeros(DFT_size,2*blocks,num_cols);
p_elements=zeros(DFT_size,2*blocks);
col_sh = diag( ones(2*poly_taps-1,1), -1);
TDM_signal = zeros(num_samples,1);

for ii=1:num_cols
s_sel = 1 + mod(ii-1,Num_sigs);
SOI_type =SOI_types(s_sel);
SOI_carrier=SOI_carriers(s_sel);
Freq_inv =SOI_Freq_inv(s_sel);
TDM_signal = signal(:,ii);
waveform = zeros(DFT_size/2,2*poly_taps);
waveform2= zeros(DFT_size,poly_taps);

fprintf('Block\n');
for i = 1:(2*blocks)
fprintf('%3i',i);
if (mod(i,20)==0); fprintf('\n'); end;
waveform = waveform * col_sh;
waveform(:,2*poly_taps) = ...
real(signal( ((i-1)*DFT_size/2+1):i*DFT_size/2));
waveform2 = reshape(waveform,DFT_size,poly_taps);
[channels(:,i,ii),p_elements(:,i)] = ...
offt_analysis(waveform2,poly_taps,Afilter);
channels(:,i,ii) = channels(:,i,ii) .* (exp(-sqrt(-
1)*pi*i*(0.5:1:DFT_size)'));

waveform3 = reshape(waveform,poly_taps*DFT_size,1);
channels2(:,i,ii) = fft(waveform3 .* Afilter);
channels3(:,i,ii) = fft(waveform3(1:DFT_size));
end

%
% Plot the cummulative power in each bin
%
figure(1)
chan_mesh = psdg(channels(1:DFT_size/2,:,ii)/sum(Afilter))';
spec1=dB(sum(chan_mesh(poly_taps:blocks,:))/(blocks-poly_taps+1));
plot(spec1)
title_var = sprintf('Cumulative OFFT Power Spectrum: Antenna #%g',ii);
title(title_var)
xlabel('Frequency Cells');
ylabel('Power (dB)');
grid;
tempaxis=axis;
axis([ 0 DFT_size/2 tempaxis(3:4)])

figure(2)
chan_mesh2 = psdg(channels2(1:DFT_size*poly_taps/2,:,ii)/sum(Afilter))';
spec2=dB(sum(chan_mesh2(poly_taps:blocks,:))/(blocks-poly_taps+1));
plot(spec2)
title_var = sprintf('Cumulative W-FFT Power Spectrum: Antenna #%g',ii);
title(title_var)
xlabel('Frequency Cells');
ylabel('Power (dB)');
grid;
tempaxis=axis;
axis([ 0 DFT_size*poly_taps/2 tempaxis(3:4)])

Spectral Analysis Imp. 16 B.J. Bazuin


figure(3)
chan_mesh3 = psdg(channels3(1:DFT_size/2,:,ii)/DFT_size)';
spec3=dB(sum(chan_mesh3(poly_taps:blocks,:))/(blocks-poly_taps+1));
plot(spec3)
title_var = sprintf('Cumulative FFT Power Spectrum: Antenna #%g',ii);
title(title_var)
xlabel('Frequency Cells');
ylabel('Power (dB)');
grid;
tempaxis=axis;
axis([ 0 DFT_size/2 tempaxis(3:4)])

figure(4)
chan_mesh4 =
psdg(channels2((1+poly_taps/2):poly_taps:DFT_size*poly_taps/2,:,ii) ...
/sum(Afilter))';
spec4=dB(sum(chan_mesh4(poly_taps:blocks,:))/(blocks-poly_taps+1));
plot(spec4)
title_var = sprintf('Cumulative Decimated W-FFT Power Spectrum: Antenna
#%g',ii);
title(title_var)
xlabel('Frequency Cells');
ylabel('Power (dB)');
grid;
tempaxis=axis;
axis([ 0 DFT_size/2 tempaxis(3:4)])

drawnow; pause

figure(1);
plot(dB(chan_mesh));
axis([0 200 -100 0]);
grid;

figure(2);
plot(dB(chan_mesh2));
axis([0 200 -100 0]);
grid;

figure(3);
plot(dB(chan_mesh3));
axis([0 200 -100 0]);
grid;

figure(4);
plot(dB(chan_mesh4));
axis([0 200 -100 0]);
grid;

drawnow; pause

Spectral Analysis Imp. 17 B.J. Bazuin


% Plot the 3D mesh power plots
%
if (plot_mesh==1)
figure(1)
spec_full=dB((abs( channels(1:DFT_size/2,:,ii) )).^2);
spec_full2=spec_full-max(max(spec_full));
spec_frame=(spec_full2>=-100);
spec_full2=spec_full2 .* spec_frame + (~spec_frame) * (-100);
%pause
mesh(spec_full2)
title('Channelizer Output Power (in dB), -100 dB floor')
clear spec_full spec_full2 spec_frame

figure(2)
spec_full3=dB((abs( channels2(1:DFT_size*poly_taps/2,:,ii) )).^2);
spec_full4=spec_full3-max(max(spec_full3));
spec_frame2=(spec_full4>=-100);
spec_full4=spec_full4 .* spec_frame2 + (~spec_frame2) * (-100);
%pause
mesh(spec_full4)
title('Channelizer Output Power (in dB), -100 dB floor')
clear spec_full3 spec_full4 spec_frame2

figure(3)
spec_full=dB((abs( channels3(1:DFT_size/2,:,ii) )).^2);
spec_full2=spec_full-max(max(spec_full));
spec_frame=(spec_full2>=-100);
spec_full2=spec_full2 .* spec_frame + (~spec_frame) * (-100);
%pause
mesh(spec_full2)
title('Channelizer Output Power (in dB), -100 dB floor')
clear spec_full spec_full2 spec_frame

end

fprintf([sTSG_title '\n' sTSG_label '\n'])


anal_gain = (DFT_size/sum(Afilter));
laten = DFT_size*(poly_taps-1)/2;

fprintf('\n %0.0f flops \n',flops)


t_endanal=clock;
elapsed=round(100*etime(t_endanal,t_start)/60)/100;
fprintf('Processing Time was %g minutes \n',elapsed)

fprintf('Filter Bank Analysis Completed.\n');


end % end of ii loop

fprintf('\n %0.0f flops \n',flops)


t_end=clock;
elapsed=round(100*etime(t_end,t_start)/60)/100;
fprintf('Processing Time was %g minutes \n',elapsed)

fprintf('Precombiner Test Completed.\n');

Spectral Analysis Imp. 18 B.J. Bazuin


3.2 OFFT_ANALYSIS Routine
function [sample,poly_elements] = ...
offt_analysis(waveform,poly_taps,filter_coef)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FUNCTION [sample,swindow] =
% OFFT_analysis(waveform,poly_taps,filter_coef)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Polyphase Filter Function
%
% Inputs:
% waveform => Column modulated Real waveform
% poly_taps => Number of polyphase taps
% filter_coef => Filter coefficients to use
% Outputs:
% sample => Resultant complex output
% poly_elements => Polyphase elements
% Calls:
% COFFT
%

[wrow,wcol]=size(waveform);
num_samples = wrow*wcol;
if (length(filter_coef) ~= num_samples)
error('PP_analysis: filter and signal length mismatch')
end
DFT_size = num_samples/poly_taps;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Polyphase Filter %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Form a DFT_size x poly_samples matrix of the points
x_matrix = ((waveform));

% Form a DFT_size x poly_samples matrix of the filter


% ( ie. h(rN-p) )
h_matrix = reshape(filter_coef,DFT_size,poly_taps);
h_matrix = flipud(fliplr(h_matrix));

% Perform -1 modulation for OFFT operation


% ( ie. W(2N)^rN * h(rN-p) )
h_mod = h_matrix * diag([(-1).^(0:(poly_taps-1))]);

% Generate the polyphase elements


% ( ie. sum ( W(2N)^rN * h(rN-p)* x((m-Ir)N/I+p) ) )
if (wcol == 1)
poly_elements = (x_matrix' .* h_mod')';
else
poly_elements = sum(x_matrix' .* h_mod')';
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Perform the OFFT %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
sample = offt(poly_elements,DFT_size);

Spectral Analysis Imp. 19 B.J. Bazuin


3.3 OFFT Routine
function [dact]=OFFT(x,xform)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FUNCTION [dact]=OFFT(x,xform)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Odd-point FFT of real input data
% the nearest 2^N is used for the transform
%
% Inputs:
% x = The real data to be tranformed
% xform = The length of the transform
%
% Outputs
% dact = The OFFT result
%

if (nargin==1)
xform = length(x);
end

if (rem(log(xform)/log(2),1) ~= 0)
error('OFFT: The transform size is not a power of 2')
end

if (max(abs(imag(x)))) ~= 0
fprintf('OFFT: Taking the real part of the input data\n')
end

data=real(x);

% Odd-point packing
datapk = data(1:(xform/2)) - sqrt(-1)*data(((xform/2)+1):xform);

% Shift data 1/2 cell (ie. (W(2N)^n) )


datapksh = datapk .* exp(-sqrt(-1)*2*pi*(0:((xform/2)-1))'/(2*xform));

% Perform length xform/2 odd-point transform


dodd = fft(datapksh);

% Extract the points


dact(1:2:(xform-1),1) = dodd; % Even points
dact(2:2:xform,1) = conj(dodd((xform/2):-1:1)); % Odd points

Spectral Analysis Imp. 20 B.J. Bazuin


4 References
[1] R.E. Crochiere and L.R. Rabiner, "Multirate Digital Signal Processing," Prentice-
Hall, Inc., Englewood Cliffs, N.J., 1983.

[2] P.P. Vaidyanathan, "Multirate Systems and Filter Banks," Prentice-Hall, Inc.,
Englewood Cliffs, N.J., 1993.

[3] J. Masson and Z.Picel, "Flexible Design of Computationaly Efficient Nearly


Perfect QMF Filter Banks," Proc. ICASSP, 1985, pp. 541-544.

Spectral Analysis Imp. 21 B.J. Bazuin