# rootmusic

Root MUSIC algorithm

## Syntax

``w = rootmusic(x,p)``
``[w,pow] = rootmusic(x,p)``
``[w,pow] = rootmusic(___,'corr')``
``[f,pow] = rootmusic(___,fs)``

## Description

````w = rootmusic(x,p)` estimates the frequency content in the input signal `x` and returns `w`, a vector of frequencies in rad/sample. You can specify the signal subspace dimension using the input argument `p`.The extra threshold parameter in the second entry in `p` provides you more flexibility and control in assigning the noise and signal subspaces.```
````[w,pow] = rootmusic(x,p)` returns the vector of frequencies `w` and the corresponding signal power in the vector `pow`.```

example

````[w,pow] = rootmusic(___,'corr')` forces the input argument `x` to be interpreted as a correlation matrix rather than a matrix of signal data. For this syntax, `x` must be a square matrix, and all of its eigenvalues must be nonnegative. This syntax can include the input arguments from the previous syntax. NoteYou can place `'corr'` anywhere after `p`. ```
````[f,pow] = rootmusic(___,fs)` returns the vector of frequencies `f` calculated in Hz. You supply the sampling frequency `fs` in Hz.```

## Examples

collapse all

Estimate the amplitudes for two sinusoids in noise. The separation between the sinusoids is less than the resolution of the periodogram, $2\pi /N$ radians/sample. Use the autocorrelation matrix as the input to `rootmusic`.

```rng default n = (0:99)'; frqs = [pi/4 pi/4+0.06]; s = 2*exp(1j*frqs(1)*n)+1.5*exp(1j*frqs(2)*n)+ ... 0.5*randn(100,1)+1j*0.5*randn(100,1); [~,R] = corrmtx(s,12,'mod'); [W,P] = rootmusic(R,2,'corr')```
```W = 2×1 0.7946 0.8917 ```
```P = 2×1 4.1535 0.7797 ```

## Input Arguments

collapse all

Input signal, specified as a vector or matrix. If `x` is a vector, then it is treated as one observation of the signal. If `x` is a matrix, 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.

For complex-valued input data `x`, `pow` and `w` have the same length. For real-valued input data `x`, the length of the corresponding power vector `pow` is `0.5*length(w)`.

Note

You can use the output of `corrmtx` to generate such an array `x`.

Complex Number Support: Yes

Subspace dimension, specified as a real positive integer or a two-element vector. If `p` is a real positive integer, then it is treated as the subspace dimension. If `p` is a two-element vector, 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.

Sample rate, specified as a positive scalar. You can supply the sample rate `fs`in Hz. If you specify `fs` as the empty vector [], the sample rate defaults to `1` Hz.

## Output Arguments

collapse all

Output frequencies in rad/sample, returned as a vector. The length of the vector `w` is the computed dimension of the signal subspace.

Signal power, returned as a vector.

Output frequencies in Hz, returned as a vector. You supply the sampling frequency `fs` in Hz. If you specify `fs` with the empty vector [], the sampling frequency defaults to `1` Hz.

## Tips

If the input signal `x` is real, and an odd number of sinusoids is specified by `p`, an error message is displayed:

```Real signals require an even number p of complex sinusoids. ```

## Algorithms

The multiple signal classification (MUSIC) algorithm used by `rootmusic` is the same as that used by `pmusic`. The algorithm performs eigenspace analysis of the signal's correlation matrix in order to estimate the signal's frequency content.

The difference between `pmusic` and `rootmusic` is:

• `pmusic` returns the pseudospectrum at all frequency samples.

• `rootmusic` returns the estimated discrete frequency spectrum, along with the corresponding signal power estimates.

`rootmusic` is most useful for frequency estimation of signals made up of a sum of sinusoids embedded in additive white Gaussian noise.