Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Signal-to-noise ratio

`r = snr(x,y)`

`r = snr(x)`

`r = snr(x,fs,n)`

`r = snr(pxx,f,'psd')`

`r = snr(pxx,f,n,'psd')`

`r = snr(sxx,f,rbw,'power')`

`r = snr(sxx,f,rbw,n,'power')`

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

```
[r,noisepow]
= snr(___)
```

`snr(___)`

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

= snr(`x`

,`y`

)`x`

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

. `y`

must have
the same dimensions as `x`

. 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 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)`

.