Signal Processing Toolbox 
Pseudospectrum using MUSIC algorithm
Syntax
[S,w]=
pmusic(x,p) [S,w]=
pmusic(...,nfft) [S,f]=
pmusic(x,p,nfft,fs)) [S,f]=
pmusic(...,'corr
') [S,f]=
pmusic(x,p,nfft,fs,nwin,noverlap) [...]=
pmusic(...,'range
') [...,v,e]=
pmusic(...) pmusic(...)
Description
[S,w]
implements the MUSIC (Multiple Signal Classification) algorithm and returns =
pmusic(x,p)
S
, the pseudospectrum estimate of the input signal x
, and a vector w
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:
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:
p
.
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.
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.
Real/Complex Input Data 
Length of S and w 
Range of the Corresponding Normalized Frequencies 
Realvalued 
129 
[0, ] 
Complexvalued 
256 
[0, 2) 
[S,w]
specifies the length of the FFT used to estimate the pseudospectrum with the integer =
pmusic(...,nfft)
nfft
. 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
in this syntax.
[S,f]
returns the pseudospectrum in the vector =
pmusic(x,p,nfft,fs)
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 Table , S and Frequency Vector Characteristics above. The following table indicates the frequency range for f
for this syntax.
Real/Complex Input Data 
nfft Even/Odd 
Range of f 
Realvalued 
Even 
[0,fs/2] 
Realvalued 
Odd 
[0,fs/2) 
Complexvalued 
Even or odd 
[0,fs) 
forces the input argument [S,f] = pmusic(...,'
corr
')
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]
allows you to specify =
pmusic(x,p,nfft,fs,nwin,noverlap)
nwin
, a scalar integer indicating a rectangular window length, or a realvalued 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 nwin1
.
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.
See the Table , Eigenvector Length Depending on Input Data and Syntax below for related information on this syntax.
[...]
specifies the range of frequency values to include in =
pmusic(...,'range
')
f
or w
. This syntax is useful when x
is real. 'range
' can be either:
'whole'
: Compute the pseudospectrum over the frequency range [0,fs)
. This is the default for determining the frequency range for complexvalued x
.
fs
as the empty vector, []
, the frequency range is [0,1)
.
fs
, the frequency range is [0, 2).
'half'
: Compute the pseudospectrum over the frequency ranges specified for real x
. This is the default for determining the frequency range for realvalued x
.
Note
You can put the string arguments ' range ' or ' corr ' anywhere in the input argument list after p . 
[...,v,e]
returns the matrix =
pmusic(...)
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.
pmusic(...)
with no output arguments plots the pseudospectrum in the current figure window.
Remarks
In the process of estimating the pseudospectrum, pmusic
computes the noise and signal subspaces from the estimated eigenvectors v_{j }and eigenvalues _{j} of the signal's correlation matrix. The smallest of these eigenvalues is used in conjunction with the threshold parameter p(2)
to affect the dimension of the noise subspace in some cases.
The length n of the eigenvectors computed by pmusic
is the sum of the dimensions of the signal and noise subspaces. This eigenvector length depends on your input (signal data or correlation matrix) and the syntax you use.
The following table summarizes the dependency of the eigenvector length on the input argument.
You should specify nwin
> p(1)
or length(nwin)
> p(1)
if you want p(2)
> 1
to have any effect.
Example 1: pmusic with no Sampling Specified
This example analyzes a signal vector x
, assuming that two real sinusoidal components are present in the signal subspace. In this case, the dimension of the signal subspace is 4 because each real sinusoid is the sum of two complex exponentials:
Example 2: Specifying Sampling Frequency and Subspace Dimensions
This example analyzes the same signal vector x
with an eigenvalue cutoff of 10% above the minimum. Setting p(1)
= Inf
forces the signal/noise subspace decision to be based on the threshold parameter p(2)
. Specify the eigenvectors of length 7 using the nwin
argument, and set the sampling frequency fs
to 8 kHz:
randn('state',0); n=
0:199; x=
cos(0.257*pi*n) + sin(0.2*pi*n) + 0.01*randn(size(n)); [P,f]=
pmusic(x,[Inf,1.1],[],8000,7); % Window length=
7
Example 3: Entering a Correlation Matrix
Supply a positive definite correlation matrix R
for estimating the spectral density. Use the default 256 samples:
Example 4: Entering a Signal Data Matrix Generated from corrmtx
Enter a signal data matrix Xm generated from data using corrmtx
:
randn('state',0); n = 0:699; x=
cos(0.257*pi*(n)) + 0.1*randn(size(n)); Xm = corrmtx(x,7,'mod'); [P,w]=
pmusic(Xm,2);
Example 5: Using Windowing to Create the Effect of a Signal Data Matrix
Use the same signal, but let pmusic
form the 100by7 data matrix using its windowing input arguments. In addition, specify an FFT of length 512:
randn('state',0); n = 0:699; x=
cos(0.257*pi*(n)) + 0.1*randn(size(n)); [PP,ff]=
pmusic(x,2,512,[],7,0);
Algorithm
The name MUSIC is an acronym for MUltiple SIgnal Classification. The MUSIC algorithm estimates the pseudospectrum from a signal or a correlation matrix using Schmidt's eigenspace analysis method [1]. The algorithm performs eigenspace analysis of the signal's correlation matrix in order to estimate the signal's frequency content. This algorithm is particularly suitable for signals that are the sum of sinusoids with additive white Gaussian noise. The eigenvalues and eigenvectors of the signal's correlation matrix are estimated if you don't supply the correlation matrix.
The MUSIC pseudospectrum estimate is given by
where N is the dimension of the eigenvectors and v_{k }is the kth eigenvector of the correlation matrix. The integer p is the dimension of the signal subspace, so the eigenvectors v_{k} used in the sum correspond to the smallest eigenvalues and also span the noise subspace. The vector e(f) consists of complex exponentials, so the inner product
amounts to a Fourier transform. This is used for computation of the pseudospectrum estimate. The FFT is computed for each v_{k} and then the squared magnitudes are summed.
See Also
corrmtx
, pburg
, peig
, periodogram
, pmtm
, prony
, pwelch
, rooteig
, rootmusic
References
[1] Marple, S.L. Digital Spectral Analysis, Englewood Cliffs, NJ, PrenticeHall, 1987, pp. 373378.
[2] Schmidt, R.O, "Multiple Emitter Location and Signal Parameter Estimation," IEEE Trans. Antennas Propagation, Vol. AP34 (March 1986), pp. 276280.
[3] Stoica, P., and R.L. Moses, Introduction to Spectral Analysis, PrenticeHall, Englewood Cliffs, NJ, 1997.
pmtm  poly2ac 
© 19942005 The MathWorks, Inc.