Main Content

Signal-to-noise ratio

returns the signal-to-noise ratio (SNR) in decibels of a signal,
`r`

= snr(`xi`

,`y`

)`xi`

, by computing the ratio of its summed squared
magnitude to that of the noise `y`

:

```
r =
```

.`mag2db`

(`rssq`

(`xi`

(:))/`rssq`

(`y`

(:)))

`y`

must have the same dimensions as
`xi`

. Use this form when the input signal is not
necessarily sinusoidal and you have an estimate of the noise.

returns the SNR in
decibels relative to the carrier (dBc) of a real-valued sinusoidal input signal,
`r`

= snr(`x`

)`x`

. The SNR is determined using a modified periodogram
of the same length as the input. The modified periodogram uses a Kaiser window
with *β* = 38. The result excludes the power of the first six harmonics,
including the fundamental.

removes harmonics
of the fundamental that are aliased into the Nyquist range. Use this option when
the sinusoidal input signal is undersampled. If you do not specify this option,
or if you set it to `r`

= snr(___,'aliased')`'omitaliases'`

, then the function treats
as noise any harmonics of the fundamental frequency that lie beyond the Nyquist
range.

`snr(___)`

with no output arguments plots the spectrum of the
signal in the current figure window and labels its main features. It uses
different colors to draw the fundamental component, the DC value and the
harmonics, and the noise. The SNR appears above the plot. This functionality
works for all syntaxes listed above except

.`snr`

(`x`

,`y`

)