Learn R Programming

gasper (version 1.1.6)

SNR: Compute the Signal to Noise Ratio

Description

SNR computes the Signal to Noise Ratio (SNR) between two signals, indicating the level of desired signal to the level of background noise.

Usage

SNR(x, y)

Value

SNR Numeric. Signal to Noise Ratio.

Arguments

x

Numeric vector/matrix. Original reference signal.

y

Numeric vector/matrix. Restored or noisy signal.

Details

Higher values of SNR indicate a cleaner signal compared to the noise level. The SNR is computed as the ratio of the power of the signal (or the square of the Euclidean norm of the signal) to the power of the noise (or the square of the Euclidean norm of the signal difference), represented in decibels (dB).

The SNR is defined by: $$\mathrm{SNR}(x,y) = 20 \log_{10}\left(\frac{\|x\|_2}{\|x-y\|_2}\right)$$

See Also

PSNR

Examples

Run this code
x <- cos(seq(0, 10, length=100))
y <- x + rnorm(100, sd=0.5)
SNR(x, y)

Run the code above in your browser using DataLab