Spectral Analysis: Modern Techniques
NON-PARAMETRIC EIGENANALYSIS FREQUENCY ESTIMATION
Eigenanalysis spectral methods are promoted as having better resolution and better frequency estimation characteristics, especially at high noise levels.* They are particularly effective in identifying sinusoidal, exponential, or other narrow-band processes in white noise as these methods can eliminate much of the noise contribution. However, if the noise is not white, but contains some spectral features (i.e., colored noise), performance can be degraded. The key feature of eigenvector approaches is to divide the information contained in the data wave-form (or autocorrelation function) into two subspaces: a signal subspace and a noise subspace. The eigen-decomposition produces eigenvalues of decreasing order, and, most importantly, eigenvectors that are orthonormal. Since all the eigenvectors are orthonormal, if those eigenvectors that are deemed part of the noise subspace are eliminated, the influence of that noise is effectively elimi-nated. Functions can be computed based on either signal or noise subspace and can be plotted in the frequency domain. Such plots generally show sharp peaks where sinusoids or narrowband processes exist. Unlike parametric methods dis-cussed above, these techniques are not considered true power spectral estima-tors, since they do not preserve signal power, nor can the autocorrelation se-quence be reconstructed by applying the Fourier transform to these estimators.
Better termed frequency estimators, they provide spectra in relative units.
The most problematic aspect of applying eigenvector spectral analysis is selecting the appropriate dimension of the signal (or noise) subspace. If the number of narrowband processes is known, then the signal subspace can be dimensioned on this basis; since each real sinusoid is the sum of two complex exponentials, the signal subspace dimension should be twice the number of sinu-soids, or narrowband processes present. In some applications the signal subspace can be determined by the size of the eigenvalues; however, this method does not often work in practice, particularly with short data segments† [Marple,
*Another application of eigen-decomposition, principal component analysis, will be presented in Chapter 9.
†A similar use of eigenvalues is the determination of dimension in multivariate data as shown in Chapter 9. The Scree plot, a plot of eigenvalue against eigenvalue numbers is sometime used to estimate signal subspace dimension (see Figure 9.7). This plot is also found in Example 5.3.
TLFeBOOK
Modern Spectral Analysis 137
1987]. As with the determination of the order of an AR model, the determination of the signal subspace often relies the on trial-and-error approach.
Figure 5.5 shows the importance of subspace dimension and illustrates both the strength and weaknesses of eigenvector spectral analysis. All four spec-tra were obtained from the same small data set (N= 32) consisting of two closely spaced sinusoids (320 and 380 Hz) in white noise (SNR= -7 db). Figure 5.5A shows the spectrum obtained using the classical, FFT-based Welch method. The other three plots show spectra obtained using eigenvector analysis, but with different partitions between the signal and noise subspaces. In Figure 5.5B, the spectrum was obtained using a signal subspace dimension of three. In this case, the size of the signal subspace is not large enough to differentiate
FIGURE5.5 Spectra produced from a short data sequence (N= 32) containing two closely spaced sinusoids (320 and 380 Hz) in white noise (SNR= 7 db). The upper-left plot was obtained using the classical Welch method while the other three use eigenvector analysis with different partitions between the signal and noise subspace.
TLFeBOOK
between the two closely spaced sinusoids, and, indeed, only a single peak is shown. When the signal subspace dimension is increased to 6 (Figure 5.5C) the two sinusoidal peaks are clearly distinguished and show better separation than with the classical method. However, when the signal subspace is enlarged fur-ther to a dimension of 11 (Figure 5.5D), the resulting spectrum contains small spurious peaks, and the two closely spaced sinusoids can no longer be distin-guished. Hence, a signal subspace that is too large can be even more detrimental than one that is too small.
MATLAB Implementation
Two popular versions of frequency estimation based on eigenanalysis are the Pisarenko harmonic decomposition (PHP) and the MUltiple SIgnal Classifica-tions (MUSIC) algorithms. These two eigenvector spectral analysis methods are available in the MATLAB Signal Processing Toolbox. Both methods have the same calling structure, a structure similar to that used by the AR routines. The command to evoke MUSIC algorithm is:
[PS, f,v,e] = pmusic(x, [p thresh], nfft, Fs, window, noverlap);
The last four input arguments are optional and have the same meaning as inpwelch, except that ifwindowis a scalar or omitted, a rectangular window is used (as opposed to a Hamming window). The second argument is used to control the dimension of the signal (or noise) subspace. Since this parameter is critical to the successful application of the eigenvector approach, extra flexibil-ity is provided. This argument can be either a scalar or vector. If only a single number is used, it will be taken asp, the dimension of the signal subspace. If the optionalthreshis included, then eigenvalues belowthreshtimes the mini-mum eigenvalue (i.e., thresh × λmin) will be assigned to the noise subspace;
however, pstill specifies the maximum signal subspace. Thus, threshcan be used to reduce the signal subspace dimension below that specified by p. To be meaningful,threshmust be> 1, otherwise the noise threshold would be < λmin
and its subspace dimension would be 0 (hence, if thresh < 1 it is ignored).
Similarlypmust be < n, the dimension of the eigenvectors. The dimension of the eigenvectors, n, is eithernfft, or if not specified, the default value of 256.
Alternatively, n is the size of the data matrix if thecorroption is used, and the input is the correlation matrix as described below.
As suggested above, the data argument,x, is also more flexible. Ifxis a vector, then it is taken as one observation of the signal as in previous AR and Welch routines. However, x can also be a matrix in which case the routine assumes that each row ofxis a separate observation of the signal. For example, each row could be the output of an array of sensors or a single response in a
TLFeBOOK
Modern Spectral Analysis 139
response ensemble. Such data are termed multivariate and are discussed in Chapter 9. Finally, the input argumentxcould be the correlation matrix. In this case, xmust be a square matrix and the argument‘corr’ should be added to the input sequence anywhere after the argumentp. If the input is the correlation matrix, then the arguments window and noverlap have no meaning and are ignored.
The only required output argument isPS, which contains the power spec-trum (more appropriately termed the pseudospecspec-trum due to the limitation de-scribed previously). The second output argument, f, is the familiar frequency vector useful in plotting. The output argument, v, following f, is a matrix of eigenvectors spanning the noise subspace (one per column) and the final output argument,e, is either a vector of singular values (squared) or a vector of eigen-values of the correlation matrix when the input argument ‘corr’is used. An example of the use of the pmusic routine is given in the example below. An alternative eigenvector method can be implemented using the call peig. This routine has a calling structure identical to that ofpmusic.
Example 5.3 This example compares classical, autoregressive and eigenanalysis spectral analysis methods, plots the singular values, generates Fig-ure 5.6, and uses an optimum value for AR model order and eigenanalysis subspace dimension.
% Example 5.3 and Figure 5.6
% Compares FFT-based, AR, and eigenanalysis spectral methods
%
close all; clear all;
N = 1024; % Size of arrays
fs = 1000; % Sampling frequency
%
% Generate a spectra of sinusoids and noise [data,t] = sig_noise([50 80 240 400],-10,N);
%
% Estimate the Welch spectrum for comparison, no window and
% no overlap
[PS,f] = pwelch(x,N,[],[],fs);
subplot(2,2,1); % Plot spectrum and label plot(f,PS,’k’);
...axis, labels, title...
% Calculate the modified covariance spectrum for comparison subplot(2,2,2); % Plot spectrum and label [PS,f] = pmcov(x,15,N,fs);
plot(f,PS,’k’);
...labels, title...
% Generate the eigenvector spectrum using the MUSIC method
TLFeBOOK
FIGURE5.6 Spectrum obtained using 3 different methods applied to a waveform containing 4 equal amplitude sinusoids at frequencies of 50, 80, 240, and 400 Hz and white noise (SNR= -10 db; N = 1024). The eigenvector method (C) most clearly identifies the four components. The singular values determined from the eigenvalues (D) show a possible break or change in slope around n= 4 and an-other at n= 9, the latter being close to the actual signal subspace of 8.
% no window and no overlap subplot(2,2,3);
[PS,f] = pmusic(x,11,N,fs);
plot(f,PS,’k’); % Plot spectrum and label ...labels, title...
%
% Get the singular values from the eigenvector routine
% and plot. Use high subspace dimension to get many singular
% values subplot(2,2,4);
TLFeBOOK
Modern Spectral Analysis 141
[PS,f,evects,svals] = % Get eigenvalues (svals) pmusic(x,30,N, fs);
plot(svals,’k’); % Plot singular values ...labels, title...
The plots produced by Example 5.3 are shown in Figure 5.6, and the strength of the eigenvector method for this task is apparent. In this example, the data length was quite long (N= 1024), but the SNR was low (-10 db). The signal consists of four equal amplitude sinusoids, two of which are closely spaced (50 and 80 Hz). While the spectrum produced by the classical Welch method does detect the four peaks, it also shows a number of other peaks in response to the noise. It would be difficult to determine, definitively and uniquely, the signal peaks from this spectrum. The AR method also detects the four peaks and greatly smooths the noise, but like the Welch method it shows spurious peaks related to the noise, and the rounded spectral shapes make it difficult to accurately determine the frequencies of the peaks. The eigenvector method not only resolves the four peaks, but provides excellent frequency reso-lution.
Figure 5.6 also shows a plot of the singular values as determined by pmusic. This plot can be used to estimate the dimensionality of multivariate data as detailed in Chapter 9. Briefly, the curve is examined for a break point between a steep and gentle slope, and this break point is taken as the dimension-ality of the signal subspace. The idea is that a rapid decrease in the singular values is associated with the signal while a slower decrease indicates that the singular values are associated with the noise. Indeed, a slight break is seen around 9, approximately the correct value of the signal subspace. Unfortunately, well-defined break points are not always found when real data are involved.
The eigenvector method also performs well with short data sets. The be-havior of the eigenvector method with short data sets and other conditions is explored in the problems.
Most of the examples provided evaluate the ability of the various spectral methods to identify sinusoids or narrowband processes in the presence of noise, but what of a more complex spectrum? Example 5.4 explores the ability of the classical (FFT), model-based, and eigenvalue methods in estimating a more complicated spectrum. In this example, we use a linear process (one of the filters described in Chapter 4) driven by white noise to create a complicated broadband spectrum. Since the filter is driven by white noise, the spectrum of its output waveform should be approximately the same as the transfer function of the filter itself. The various spectral analysis techniques are applied to this waveform and their ability to estimate the actual filter Transfer Function is evaluated. The derivative FIR filter of Example 4.6 will be used, and its transfer function will be evaluated directly from the filter coefficients using the FFT.
TLFeBOOK
Example 5.4 This example is designed to compare the ability of several spectral analysis approaches, classical, model-based, and eigenvalue, to estimate a complex, broadband spectrum. The filter is the same as that used in Example 4.6 except that the derivative cutoff frequency has been increased to 0.25 fs/2.
% Example 5.4 and Figure 5.7
% Construct a spectrum for white noise passed through
% a FIR derivative filter. Use the filter in Example 4.6.
% Compare classical, model-based, and eigenvector methods
FIGURE 5.7 Estimation of a complex, broader-band spectrum using classical, model-based, and eigenvalue methods. (A) Transfer function of filter used to gen-erate the data plotted a magnitude squared. (B) Estimation of the data spectrum using the Welch (FFT) method with 2 averages and maximum overlap. (C) Esti-mation of data spectrum using AR model, p= 17. (D) Estimation of data spectrum using an eigenvalue method with a subspace dimension of 13.
TLFeBOOK
Modern Spectral Analysis 143
%
close all; clear all;
Ts = 1/200; % Assume a Ts of 5 msec
fs = 1/Ts; % Sampling frequency
fc = .25 % Derivative cutoff frequency
N = 256; % Data length
%
% The initial code is the same as Example 4.6
x = randn(N,1); % Generate white noise
%
% Design filter and plot magnitude characteristics
f1 = [ 0 fc fcⴙ.1 .9]; % Specify desired frequency curve a = [0 (fc*fs*pi) 0 0]; % Upward slope until 0.25 fs then
% lowpass b = remez(28,f1,a,’differentiator’);
x = filter(b,1,x); % Apply FIR filter
%
% Calculate and plot filter transfer function
PS = (abs(fft(b,N))).v2; % Calculate filter’s transfer
% function
subplot(2,2,1); %
f = (1:N/2)*N/(2*fs); % Generate freq. vector for
% plotting
plot(f,PS(1:N/2),’k’); % Plot filter frequency response ...labels and text...
%
[PS,f] = pwelch(x,N/4, % Use 99% overlap (N/4)-1,[ ],fs);
The plots produced by this program are shown in Figure 5.7. In Figure 5.7A, the filter’s transfer function is plotted as the magnitude squared so that it can be directly compared with the various spectral techniques that estimate the
TLFeBOOK
power spectrum of the filter’s output waveform. The parameters associated with the various approaches have been adjusted to produce as close a match to the filter transfer function as possible. The influence of some of these parameters is explored in the problems. The power spectrum produced by the classical approach is shown in Figure 5.7B and roughly approximates the spectral characteristics of the filter. The classical approach used the Welch method and averaged four segments with a maximum overlap. The model-based approach used the modified covariance method and a model order of 17, and produced a spectrum similar to that produced by the Welch method. The eigenvalue approach used a subspace of 13 and could only approximate the actual spectrum as a series of narrowband processes. This demonstrates that eigenvalue methods, while well-suited to identifying sinu-soids in noise, are not good at estimating spectra that contain broader-band features.
PROBLEMS
1. Use sig_noise to generate a 254-point data segment containing two closely spaced sinusoids at 200 and 220 Hz both with SNR of -5 db. Find the best model order to distinguish these two peaks with a minimum of spurious peaks. Use the Burg method. Repeat with an SNR of -10 db.
2. Repeat Problem 1 above, but using a shorter data segment (N= 64), and a higher SNR: -1 db. Now lower the SNR to -5 db as in Problem 1 and note the severe degradation in performance.
3. Usesig_noiseto generate a moderately long (N= 128) data segment con-sisting of a moderate (SNR= -5 db) sinusoid at 200 Hz and weak (SNR = -9 db) sinusoid at 230 Hz. Compare the spectrum generated by Welch, AR, and eigenvector methods.
4. Use the data in Problem 1 (SNR= −10db) to compare the operation of the pmusic and peig MATLAB algorithms. Use a signal space of 7 and 13 for each case. Plot power spectrum in db.
5. Usesig_noise to generate a short data segment (N= 64) containing two closely spaced sinusoids in white noise (300 and 330 Hz). Both have SNR’s of
−3 db. Compare the spectra obtained with the Welch, AR–Burg, and eigenvalue methods. For the AR model and eigenvector method chose a model or subspace order ranging between 5 to 19. Show the best case frequency plots.
6. Construct a broadband spectrum by passing white noise through a filter as in Example 5.4. Use the IIR bandpass filter of Example 4.7 (and Figure 4.16).
Generate the filter’s transfer function directly from the coefficients, as in
Exam-TLFeBOOK
Modern Spectral Analysis 145
ple 5.4. (Note you will have to take the FFT of both numerator and denominator coefficients and divide, or usefreqz.) Next compare the spectrum produced by the three methods, as in Example 5.4. Adjust the parameters for the best rela-tionship between the filter’s actual spectrum and that produced by the various methods.
TLFeBOOK