# spsmooth

Spatial smoothing

## Syntax

``RSM = spsmooth(R,L)``
``RSM = spsmooth(R,L,'fb')``

## Description

example

````RSM = spsmooth(R,L)` computes an averaged spatial covariance matrix, `RSM`, from the full spatial covariance matrix, `R`, using spatial smoothing (see Van Trees , p. 605). Spatial smoothing creates a smaller averaged covariance matrix over L maximum overlapped subarrays. L is a positive integer less than N. The resulting covariance matrix, `RSM`, has dimensions (N–L+1)-by-(N–L+1). Spatial smoothing is useful when two or more signals are correlated.```
````RSM = spsmooth(R,L,'fb')` computes an averaged covariance matrix and at the same time performing forward-backward averaging. This syntax can use any of the input arguments in the previous syntax.```

## Examples

collapse all

Construct a 10-element half-wavelength-spaced uniform line array receiving two plane waves arriving from 0° and -25° azimuth. Both elevation angles are 0°. Assume the two signals are partially correlated. The SNR for each signal is 5 dB. The noise is spatially and temporally Gaussian white noise. First, create the spatial covariance matrix from the signal and noise. Then, solve for the number of signals, using `rootmusicdoa`. Next, perform spatial smoothing on the covariance matrix, using `spsmooth`, and solve for the signal arrival angles again using `rootmusicdoa`.

Set up the array and signals. Then, generate the spatial covariance matrix for the array from the signals and noise.

```N = 10; d = 0.5; elementPos = (0:N-1)*d; angles = [0 -25]; ac = [1 1/5]; scov = ac'*ac; R = sensorcov(elementPos,angles,db2pow(-5),scov);```

Solve for the arrival angles using the original covariance matrix.

```Nsig = 2; doa = rootmusicdoa(R,Nsig)```
```doa = 1×2 0.2099 41.3166 ```

The solved-for arrival angles are wrong - they do not agree with the known angles of arrival used to create the covariance matrix.

Next, solve for the arrival angles using a smoothed covariance matrix. Perform spatial smoothing to detect L-1 coherent signals. Choose L = 3.

```Nsig = 2; L = 2; RSM = spsmooth(R,L); doasm = rootmusicdoa(RSM,Nsig)```
```doasm = 1×2 -25.0000 -0.0000 ```

In this case, computed angles do agree with the known angles of arrival.

## Input Arguments

collapse all

Spatial covariance matrix, specified as a complex-valued, positive-definite N-by-N matrix. In this matrix, N represents the number of sensor elements.

Example: [ 4.3162, –0.2777 –0.2337i; –0.2777 + 0.2337i , 4.3162]

Data Types: `double`
Complex Number Support: Yes

Maximum number of overlapped subarrays, specified as a positive integer. The value L must be less than the number of sensors, N.

Example: 2

Data Types: `double`

## Output Arguments

collapse all

Smoothed covariance matrix, returned as a complex-valued, M-by-M matrix. The dimension M is given by M = N–L+1.

 Van Trees, H.L. Optimum Array Processing. New York, NY: Wiley-Interscience, 2002.