Overview
In many articles we have discussed that RF is a channel used to enable long-distance signal transmission. Signals in an RF channel must maintain a high signal-to-noise ratio (SNR) to travel farther. After long-distance transmission, if the transmitter's signal SNR remains sufficient, the receiver can demodulate the signal successfully. Many factors determine this, including the transmitter SNR and the receiver's demodulation threshold. This article explains how to calculate and simulate SNR in RF links.
Definition
Signal-to-noise ratio (SNR) is an important metric for assessing signal quality. It represents the ratio of signal power to noise power. A higher SNR indicates that the signal is stronger relative to the noise and therefore of better quality.
SNR can be calculated using the formula:
SNR = 10 * log10(Ps / Pn)
where Ps is the average signal power and Pn is the average noise power. The logarithmic scale is used because power is typically expressed in decibels (dB).
Thus, computing SNR requires estimating the average power of the signal and the average power of the noise.
Known Signal Power
If the signal and noise powers are known, calculating SNR is straightforward. The following example generates a periodic signal and computes its power, then generates white noise with a specified power.
T = 1; % Simulation time
dt = 0.001; % Sampling interval
t = 0: dt: 1-dt; % Time vector
N = length(t); % Sequence length
f = 10; % Signal frequency (Hz)
a = cos(2* [pi]*f*t); % Periodic signal
plot(t, a);
p = sum(a.^2)/N;
p = 10; % Set power p (example)
noise = sqrt(p)*randn(10000,1); % Generate noise with power p
noise
sum(noise.^2)/length(noise) % Estimated noise power
sum
Unknown Signal: FFT-Based SNR
If the signal is unknown, its power cannot be computed directly. Because the autocorrelation function and the power spectral density are a Fourier transform pair, SNR can be estimated via the signal's spectrum. A common approach is to perform a Fourier transform, separate signal and noise components in the frequency domain, and compute the SNR from their power difference.
For example, consider a 3 kHz tone sampled at 50 kHz with added Gaussian white noise and passed through a nonlinear amplifier that produces harmonics:
fs = 5e4;
f0 = 3e3;
N = 1024;
t = (0:N-1)/fs;
ct = cos(2*pi*f0*t);
cd = ct + 0.00008*randn(size(ct));
amp = [1e-5 5e-6 -1e-3 6e-5 1 25e-3];
sgn = polyval(amp,cd);
snr(sgn,fs);
MATLAB snr Function
The MATLAB function syntax and behavior:
r = snr(x, fs, n)
returns the SNR in dBc of a real sinusoidal input signal x sampled at rate fs. The computation excludes the power contained in the lowest n harmonics, including the fundamental. The default value of fs is 1. The default value of n is 6.
Summary
There are two common SNR calculation approaches: 1) when the signal power is known, compute SNR directly from power estimates; 2) when the signal is unknown, use spectral analysis (FFT) to separate signal and noise components and compute SNR. SNR estimation through measurement and simulation can reproduce realistic channel conditions and help optimize RF link parameters to improve SNR.