DSPRelated.com
Forums

Band limited Gaussian White noise generation

Started by veccia October 12, 2011
On 10/13/2011 2:02 AM, mnentwig wrote:
>>> sigma of Gaussian PDF > first of all, a periodic signal should be fine. So it just loops around. > Periodic means you can simply use fft() and ifft() to go back and forth > between frequency and time domain. > > Frequency domain filtering is trivial (calculate bin frequencies, calculate > |H(f)| and multiply element-by-element (and / or set regions to zero, as > needed).
Ouch!
>>> sigma of Gaussian PDF > isn't that simply the power of your signal?
No. Jerry -- Engineering is the art of making what you want from things you can get.
>>> sigma of Gaussian PDF >first of all, a periodic signal should be fine. So it just loops around. >Periodic means you can simply use fft() and ifft() to go back and forth >between frequency and time domain. > >Frequency domain filtering is trivial (calculate bin frequencies,
calculate
>|H(f)| and multiply element-by-element (and / or set regions to zero, as >needed). > >>> sigma of Gaussian PDF >isn't that simply the power of your signal? >
Thanks Guys, for all replies.. since I am new here I was waiting for kind of emails in my mailbox saying sb has put a reply!! anyway this way makes my mailbox look better!! :) First of all I don't need my filter to be so sharp! Actually I need to preserve the Gaussianity and Whiteness (of course it wouldn't be white after filtering)of my signal as much as possible and at the same time filter the high frequencies. I found this somewhere saying that I can produce my signal in frequency domain with a Gaussian white noise amplitude and Uniform white noise phase. Is this right?? and if so, what would be the relationship between the sigma of my signal in time domain and the phase and amplitude parameters of signal in frequency domain?? thanks again for the fast replies.
On Oct 13, 10:39&#4294967295;am, "veccia" <vahid_bio@n_o_s_p_a_m.yahoo.com> wrote:
> I found this somewhere saying that I can > produce my signal in frequency domain with a Gaussian white noise amplitude > and Uniform white noise phase. Is this right??
No, this is absolutely wrong! In the frequency domain, if you are representing the bin values as amplitude and phase, then the amplitude of signal plus noise is a Rician random variable and the phase of signal plus noise is *not* uniformly distributed on [0,2*pi) but is peaked around the signal phase. Since you insist on beginning with the frequency domain, let me begin by congratulating you on having a brand new tool in your tool kit! In discrete time, you can simulate white Gaussian noise in the time domain by adding independent zero-mean Gaussian random variables with identical variance to each complex sample value. The noise power is twice the variance that you choose. The corresponding result in the frequency domain is obtained by adding independent zero-mean Gaussian random variables with the same variance (same as in the time domain!) to each complex -valued frequency bin or sample. If your frequency-domain samples are stored as amplitude and phase (polar representation), you will need to convert each sample to rectangular representation, add in the noise, and convert back to polar representation which is the way you are storing samples in the frequency domain. THEN you can take your shiny new toy, the iFFT, and apply it to your noisy signal in the frequency domain to convert it to the time domain. And guess what? The real and imaginary components of your time-domain discrete-time complex-valued samples will be perturbed by independent zero-mean Gaussian random variables with the same variance as you used in the frequency domain. That is, you will have achieved the same result as if you had added the noise directly to the time domain samples. In short, you will have grabbed your right ear with your right hand after wrapping your hand around your head first, but the important thing to keep in mind is that you *did* grab your ear, and you did get to use your shiny new iFFT in the process, and that's what counts, right? Dilip Sarwate
On Thu, 13 Oct 2011 09:39:05 -0500, veccia wrote:

>>>> sigma of Gaussian PDF >>first of all, a periodic signal should be fine. So it just loops around. >>Periodic means you can simply use fft() and ifft() to go back and forth >>between frequency and time domain. >> >>Frequency domain filtering is trivial (calculate bin frequencies, > calculate >>|H(f)| and multiply element-by-element (and / or set regions to zero, as >>needed). >> >>>> sigma of Gaussian PDF >>isn't that simply the power of your signal? >> >> > Thanks Guys, for all replies.. since I am new here I was waiting for > kind of emails in my mailbox saying sb has put a reply!! anyway this way > makes my mailbox look better!! :) > > First of all I don't need my filter to be so sharp! Actually I need to > preserve the Gaussianity and Whiteness (of course it wouldn't be white > after filtering)of my signal as much as possible and at the same time > filter the high frequencies. I found this somewhere saying that I can > produce my signal in frequency domain with a Gaussian white noise > amplitude and Uniform white noise phase. Is this right??
You can do this if the real and imaginary components of your spectrum are Gaussian and white. The amplitude statistics won't be Gaussian in that event.
> and if so, what > would be the relationship between the sigma of my signal in time domain > and the phase and amplitude parameters of signal in frequency domain??
The total energy of the signal in the frequency domain will be equal to the total energy of the signal in the time domain (Parseval's Theorem). This makes the problem complicated but well defined in continuous time. Unfortunately, everyone defines their FFT a bit differently -- so you'll almost always be off by a constant involving 2, pi, and the number of data points. Either calibrate your FFT routine and use that to calculate the sigma, or just generate your signal using the IFFT, calculate its average power, and scale it appropriately to get the power you want (you'll need to account for whatever the scaling factor of your shaker table is, anyway). -- www.wescottdesign.com
close all;
clear all;
n = 1e6;
n2 = 5e4;
sig = randn(1, n);

sig = fft(sig);
sig (1+n2:end-n2+1) = 0;
sig = ifft(sig);
sig = real(sig); % chop off roundoff error

hist(sig, 100); hold on;
x = -3:0.01:3;
plot(x, 36000*exp(-(2.2*x) .^ 2), 'r');

figure(); plot(sig);

Looks gaussian enough to me.

On 10/13/2011 6:45 PM, mnentwig wrote:
> close all; > clear all; > n = 1e6; > n2 = 5e4; > sig = randn(1, n); > > sig = fft(sig); > sig (1+n2:end-n2+1) = 0; > sig = ifft(sig); > sig = real(sig); % chop off roundoff error > > hist(sig, 100); hold on; > x = -3:0.01:3; > plot(x, 36000*exp(-(2.2*x) .^ 2), 'r'); > > figure(); plot(sig); > > Looks gaussian enough to me. >
Looks can be deceiving. Try sum = 0 For i=0++ sum +=rand() i<12 return sum/12 Jerry -- Engineering is the art of making what you want from things you can get.
On Oct 13, 11:31&#4294967295;pm, Jerry Avins <j...@ieee.org> wrote:
> > <<<<<deleted>>>> > > Looks can be deceiving. > > <<<<<deleted>>>> > return sum/12
Actually, "return sum-6" improves the deception since the sum of 12 random variables uniformly distributed on (0, 1) has mean 6 and variance 1.
On 10/14/2011 7:09 AM, dvsarwate wrote:
> On Oct 13, 11:31 pm, Jerry Avins<j...@ieee.org> wrote: >> >> <<<<<deleted>>>> >> >> Looks can be deceiving. >> >> <<<<<deleted>>>> >> return sum/12 > > Actually, "return sum-6" improves the deception > since the sum of 12 random variables uniformly > distributed on (0, 1) has mean 6 and variance 1.
Thank you. Zero mean is always nice! How about return((sum-6)/12) ? Jerry -- Engineering is the art of making what you want from things you can get.
yes, but isn't it supposed to be Gaussian?
What the FFT does is simple oversampling.

If the discrete-time samples have a Gaussian PDF, shouldn't the same apply
for the continuous-time waveform which is reconstructed by an ideal lowpass
filter (or approximated by the FFT with arbitrary accuracy by using more
zero padding)?

On 10/14/2011 2:09 PM, mnentwig wrote:
> yes, but isn't it supposed to be Gaussian? > What the FFT does is simple oversampling.
It isn't exactly Gaussian, but very close. (No value exceeds .5) See the central limit theorem.
> If the discrete-time samples have a Gaussian PDF, shouldn't the same apply > for the continuous-time waveform which is reconstructed by an ideal lowpass > filter (or approximated by the FFT with arbitrary accuracy by using more > zero padding)?
Do you think an FFT takes less computation than adding 12 random numbers spit out by a linear congruential generator? How much accuracy do you expect a shaker table to need? Jerry -- the least expensive Engineering is the art of making what you want from things you can get. ^