You are here : matlabSignal Processingpeig

peig() - Signal Processing

```[S,w] = peig(x,p) implements
the eigenvector spectral estimation method and returns S,
the pseudospectrum estimate of the input signal x,
and w, a vector of normalized frequencies (in rad/sample)
at which the pseudospectrum is evaluated. The pseudospectrum is calculated
using estimates of the eigenvectors of a correlation matrix associated
with the input data x, where x is
specified as either:A row or column vector representing one observation
of the signalA rectangular array for which each row of x represents
a separate observation of the signal (for example, each row is one
output of an array of sensors, as in array processing), such that x'*x is
an estimate of the correlation matrix Note

You can use the output of corrmtx to
generate such an array x.You can specify the second input argument p as
either:A scalar integer. In this case, the signal subspace
dimension is p.A two-element vector. In this case, p(2),
the second element of p, represents a threshold
that is multiplied by λmin,
the smallest estimated eigenvalue of the signal's correlation matrix.
Eigenvalues below the threshold λmin × p(2) are assigned
to the noise subspace. In this case, p(1) specifies
the maximum dimension of the signal subspace.Note:

If the inputs to peig are real sinusoids,
set the value of p to double the number of input
signals. If the inputs are complex sinusoids, set p equal
to the number of inputs.The extra threshold parameter in the second entry in p provides
you more flexibility and control in assigning the noise and signal
subspaces.S and w have the same
length. In general, the length of the FFT and the values of the input x determine
the length of the computed S and the range of the
corresponding normalized frequencies. The following table indicates
the length of S (and w) and
the range of the corresponding normalized frequencies for this syntax.S Characteristics for an FFT Length of 256
(Default)Real/Complex Input DataLength of
S and wRange of the Corresponding Normalized Frequencies
Real-valued129[0, π]
Complex-valued256[0, 2π)
[S,w] = peig(x,p,w) returns
the pseudospectrum in the vector S computed at
the normalized frequencies specified in vector w,
which has two or more elements [S,w] = peig(...,nfft) specifies
the integer length of the FFT nfft used to estimate
the pseudospectrum. The default value for nfft (entered
as an empty vector []) is 256.The following table indicates the length of S and w,
and the frequency range for w for
this syntax.S and Frequency Vector CharacteristicsReal/Complex Input Datanfft Even/OddLength of S
and wRange of w
Real-valuedEven(nfft/2 + 1)[0, π]
Real-valuedOdd(nfft + 1)/2[0, π)
Complex-valuedEven or oddnfft[0, 2π)
[S,f] = peig(x,p,nfft,fs) returns
the pseudospectrum in the vector S evaluated at
the corresponding vector of frequencies f (in Hz).
You supply the sampling frequency fs in Hz. If
you specify fs with the empty vector [],
the sampling frequency defaults to 1 Hz.The frequency range for f depends on nfft, fs,
and the values of the input x.
The length of S (and f) is the
same as in the S and Frequency Vector Characteristics above. The following
table indicates the frequency range for f for this
syntax.   S and Frequency Vector Characteristics with
fs SpecifiedReal/Complex Input Datanfft Even/OddRange of f
Real-valuedEven[0, fs/2]
Real-valuedOdd[0, fs/2)
Complex-valuedEven or odd[0, fs)
[S,f] = peig(x,p,f,fs) returns
the pseudospectrum in the vector S computed at
the frequencies specified in vector f, which has
two or more elements [S,f] = peig(...,'corr') forces
the input argument x to be interpreted as a correlation
matrix rather than matrix of signal data. For this syntax x must
be a square matrix, and all of its eigenvalues must be nonnegative.[S,f] = peig(x,p,nfft,fs,nwin,noverlap) allows
you to specify nwin, a scalar integer indicating
a rectangular window length, or a real-valued vector specifying window
coefficients. Use the scalar integer noverlap in
conjunction with nwin to specify the number of
input sample points by which successive windows overlap. noverlap is
not used if x is a matrix. The default value for nwin is
2 × p(1) and noverlap is nwin – 1.With this syntax, the input data x is segmented
and windowed before the matrix used to estimate the correlation matrix
eigenvalues is formulated. The segmentation of the data depends on nwin, noverlap,
and the form of x. Comments on the resulting windowed
segments are described in the following table.Windowed Data Depending on x and nwinInput data xForm of nwinWindowed Data
Data vectorScalarLength is nwin
Data vectorVector of coefficientsLength is length(nwin)
Data matrixScalarData is not windowed.
Data matrixVector of coefficientslength(nwin) must be the same as the
column length of x, and noverlap is
not used.
See the table, Eigenvector Length Depending on Input Data
and Syntax, for
related information on this syntax.Note

The arguments nwin and noverlap are
ignored when you include the string 'corr' in the
syntax.[...] = peig(...,freqrange) specifies
the range of frequency values to include in f or w. freqrange can
be either:'half' — returns half the
spectrum for a real input signal, x. If nfft is
even, then S has length nfft/2 + 1 and is computed over the interval
[0,π]. If nfft is odd,
the length of S is (nfft + 1)/2 and the frequency interval is
the intervals are [0,fs/2) and [0,fs/2]
for even and odd nfft, respectively.'whole' — returns the whole
spectrum for either real or complex input, x. In
this case, S has length nfft and
is computed over the interval [0,2π). When
you specify fs, the frequency interval is [0,fs).'centered' — returns the
centered whole spectrum for either real or complex input, x.
In this case, S has length nfft and
is computed over the interval (–π,π]
for even nfft and (–π,π)
for odd nfft. When you specify fs,
the frequency intervals are (–fs/2,fs/2]
and (–fs/2,fs/2) for
even and odd nfft, respectively.Note

You can put the string arguments freqrange or 'corr' anywhere
in the input argument list after p.[...,v,e] = peig(...) returns
the matrix v of noise eigenvectors, along with
the associated eigenvalues in the vector e. The
columns of v span the noise subspace of dimension size(v,2).
The dimension of the signal subspace is size(v,1)-size(v,2).
For this syntax, e is a vector of estimated eigenvalues
of the correlation matrix.peig(...) with no output
arguments plots the pseudospectrum in the current figure window.```

Syntax

`[S,w] = peig(x,p)[S,w] = peig(x,p,w)[S,w] = peig(...,nfft)[S,f] = peig(x,p,nfft,fs)[S,f] = peig(x,p,f,fs)[S,f] = peig(...,'corr')[S,f] = peig(x,p,nfft,fs,nwin,noverlap)[...] = peig(...,freqrange)[...,v,e] = peig(...)peig(...)`

Example

```Pseudospectrum of Sum of SinusoidsOpen This Example
Implement the eigenvector method to find the pseudospectrum of the sum of three sinusoids in noise. Use the default FFT length of 256. The inputs are complex sinusoids so you set p equal to the number of inputs. Use the modified covariance method for the correlation matrix estimate.
n = 0:99;
s = exp(1i*pi/2*n)+2*exp(1i*pi/4*n)+exp(1i*pi/3*n)+randn(1,100);
X = corrmtx(s,12,'mod');
peig(X,3,'whole')

Pseudospectrum of Real SignalOpen This Example
Generate a real signal that consists of the sum of two sinusoids embedded in white Gaussian noise of unit variance. The signal is sampled at 100 Hz for 1 second. The sinusoids have frequencies of 25 Hz and 35 Hz. The lower-frequency sinusoid has twice the amplitude of the other.
fs = 100;
t = 0:1/fs:1-1/fs;

s = 2*sin(2*pi*25*t)+sin(2*pi*35*t)+randn(1,100);
Use the eigenvector method to compute the pseudospectrum of the signal between 0 and the Nyquist frequency. Specify a signal subspace dimension of 2 and a DFT length of 512.peig(s,2,512,fs,'half')

It is not possible to resolve the two sinusoids because the signal is real. Repeat the computation using a signal subspace of dimension 4.peig(s,4,512,fs,'half')```