mercredi 25 janvier 2017

How do I create band-limited (100-640 Hz) white Gaussian noise?

I would like to create 500 ms of band-limited (100-640 Hz) white Gaussian noise with a (relatively) flat frequency spectrum. The noise should be normally distributed with mean = ~0 and 99.7% of values between ± 2 (i.e. standard deviation = 2/3). My sample rate is 1280 Hz; thus, a new amplitude is generated for each frame.

duration  = 500e-3;
rate      = 1280;
amplitude = 2;

npoints   = duration * rate;
noise     = (amplitude/3)* randn( 1, npoints ); 
% Gaus distributed white noise; mean = ~0; 99.7% of amplitudes between ± 2.
time      = (0:npoints-1) / rate

Could somebody please show me how to filter the signal for the desired result (i.e. 100-640 Hz)? In addition, I was hoping somebody could also show me how to generate a graph to illustrate that the frequency spectrum is indeed flat.

I intend on importing the waveform to Signal (CED) to output as a form of transcranial electrical stimulation.




Aucun commentaire:

Enregistrer un commentaire