Theory: Sine Wave, Noise, Variance, and SNR
In our simulation, we generate a noisy sinusoidal signal:
x[n] = A * sin(2Ï€ f n / N) + w[n]
Where:
- A = amplitude of the sine wave
- f = frequency of the sine wave
- N = total number of samples
- w[n] = additive noise with zero mean and variance σ²
The variance of the noise determines how strong the noise is compared to the sine wave:
σ² = P_signal / (10^(SNR_dB / 10))
The Signal-to-Noise Ratio (SNR) in decibels is given by:
SNR_dB = 10 * log10(P_signal / σ²)
For a pure sinusoid of amplitude A, the average signal power is:
P_signal = A² / 2
Using these formulas, we can interconvert between variance and SNR, allowing us to control the noise strength and quality of the generated signal.