Reply by dilpreet06 November 5, 20072007-11-05
Hi Markus, 

thanks for your tip on the mean part. i havent had the time to figure out
yet, what the cause of the 40dB difference is, but i will put it up, once
i get the answer. thanks! 
Reply by mnentwig November 1, 20072007-11-01
Watch out when subtracting the mean value from random numbers. The
resulting noise isn't white anymore.
When observing an actual white Gaussian random process over a finite
lenght of time the observation will include a random DC term.
The longer your signal, the smaller the resulting error, though.

But this does not account for a 40 dB difference (unless your signal is a
single sample :)

One thing that comes to mind is bandwidth: Assume my sampling rate allows
for a bandwidth of 1 MHz, and the filtered noise should have a noise
bandwidth of 1 kHz. 
Since we're discarding 99.9 % of the initial noise power, it needs to be
scaled by a factor of 1000 in terms of power=variance, or sqrt(1000)=std.
deviation.


-Markus
Reply by dilpreet06 November 1, 20072007-11-01
Hello, 

I am trying to produce a coloured noise from white noise in the discrete
time domain. I do it by producing an FIR filter of coefficients b,a from
the Noise Floor (V/sqrt(Hz)), which filters white noise produced by the
randn function. 

Here is the code again: 

%Filter coefficients of Noise floor of circuit
[b,a]  = invfreqz(PSD_N.^0.5,(2*pi/fs)*(nn_f_scale),70,0,[],20,0.01);

%Generate White Noise
n_white = randn([1 B])';      % multiply of power 1
n_white = n_white - mean(n_white); % white noise must be DC free

%Generate Coloured Noise
n_out   = filter(b,a,n_white);     % filtering operation produces coloured
noise

Is this correct? Because, according to my simulation, i have a bias of
some 40dB between my analytical calculation and simulation.

Thanks for all answers! :-)

Dilpreet