The code generates a signal, d, with noise level 1. The average magnitude of d is 1. (rnd() returns a ‘random normal deviate’ which is distributed as a normal curve with 0 mean and variance of 1.) Added to the noise is the signal, cos(2πnt). We perform the Fast Fourier Transform of the artificial combined signal. We have chosen a random frequency, n = 60436 but modulated by the constant 1/100. The signal to noise ratio is thus 1/100. The peak value in the transform indeed matches the signal that we hid, but with less than a factor of two with the next loudest noise frequency.

The code is parameterized with n = 20. This is a very large sample size.