Forums

gaussian white noise using only integer arithmetic

Started by Dimiter October 2, 2003
Hi Guys,

I need to generate gaussian white noise on an integer DSP.

I have the fast Numerical Recipes generator but it has a log, a sqrt
and divides in it.

Does anyone know where I can find one or where I can read about how to
write one?

Thanks

Dimiter
Dimiter wrote:
> Hi Guys, > > I need to generate gaussian white noise on an integer DSP. > > I have the fast Numerical Recipes generator but it has a log, a sqrt > and divides in it. > > Does anyone know where I can find one or where I can read about how to > write one?
This has already been discussed many times in comp.dsp. You can search the archives of comp.dsp with google groups (which seems to be working again, incidentially). Also try http://www.dspguru.com/howto/tech/wgn.htm Regards, Andor
Dimiter wrote:
> Hi Guys, > > I need to generate gaussian white noise on an integer DSP. > > I have the fast Numerical Recipes generator but it has a log, a sqrt > and divides in it. > > Does anyone know where I can find one or where I can read about how to > write one? > > Thanks > > Dimiter
The simplest approximate method is to add 12 uniform independently distributed random numbers, subtract 6, and divide by 12.
Stan Pawlukiewicz wrote:
> Dimiter wrote: > >> Hi Guys, >> >> I need to generate gaussian white noise on an integer DSP. >> >> I have the fast Numerical Recipes generator but it has a log, a sqrt >> and divides in it. >> >> Does anyone know where I can find one or where I can read about how to >> write one? >> >> Thanks >> >> Dimiter > > > The simplest approximate method is to add 12 uniform independently > distributed random numbers
Why 12?
Andor Bariska wrote:
> Stan Pawlukiewicz wrote: > >> Dimiter wrote: >> >>> Hi Guys, >>> >>> I need to generate gaussian white noise on an integer DSP. >>> >>> I have the fast Numerical Recipes generator but it has a log, a sqrt >>> and divides in it. >>> >>> Does anyone know where I can find one or where I can read about how to >>> write one? >>> >>> Thanks >>> >>> Dimiter >> >> >> >> The simplest approximate method is to add 12 uniform independently >> distributed random numbers > > > Why 12? >
Empirical rule of thumb. A professor I had suggested this as a cheap method sufficient to do simulations with Kalman filters.
Stan Pawlukiewicz wrote:
> Andor Bariska wrote: > >> Stan Pawlukiewicz wrote: >> >>> Dimiter wrote: >>> >>>> Hi Guys, >>>> >>>> I need to generate gaussian white noise on an integer DSP. >>>> >>>> I have the fast Numerical Recipes generator but it has a log, a sqrt >>>> and divides in it. >>>> >>>> Does anyone know where I can find one or where I can read about how to >>>> write one? >>>> >>>> Thanks >>>> >>>> Dimiter >>> >>> >>> >>> >>> The simplest approximate method is to add 12 uniform independently >>> distributed random numbers >> >> >> >> Why 12? >> > > Empirical rule of thumb. A professor I had suggested this as a cheap > method sufficient to do simulations with Kalman filters. > >
And also since the variance of a uniform on (0,1) is 1/12, adding 12 gives you a variance of 1. The the divide by 12 I mentioned before isn't necessary.
In article <blhgq2$k6t$1@newslocal.mitre.org>,
Stan Pawlukiewicz <stanp@nospam_mitre.org> wrote:

>Subject: Re: gaussian white noise using only integer arithmetic >From: Stan Pawlukiewicz <stanp@nospam_mitre.org> >Reply-To: <3f7c4281$1@pfaff2.ethz.ch> >Organization: The MITRE Organization >Date: Thu, 02 Oct 2003 11:38:42 -0400 >Newsgroups: comp.dsp > >Andor Bariska wrote: >> Stan Pawlukiewicz wrote: >> >>> Dimiter wrote: >>> >>>> Hi Guys, >>>> >>>> I need to generate gaussian white noise on an integer DSP. >>>> >>>> I have the fast Numerical Recipes generator but it has a log, a sqrt >>>> and divides in it. >>>> >>>> Does anyone know where I can find one or where I can read about how to >>>> write one? >>>> >>>> Thanks >>>> >>>> Dimiter >>> >>> >>> >>> The simplest approximate method is to add 12 uniform independently >>> distributed random numbers >> >> >> Why 12? >>
Add 12 uniform random numbers over (0,1) and subtract 6. The subtract 6 makes for a zero mean. The add 12 makes for a unit variance. So the result is standard "reasonable if you are not very fussy" normal.
>Empirical rule of thumb. A professor I had suggested this as a cheap >method sufficient to do simulations with Kalman filters. > >
You might want to look at a technical report on the web:

Generating Gaussian Pseudo-Random Deviates

http://www.tsp.ece.mcgill.ca/MMSP/Documents/Reports/2000/KabalR2000c.pdf

It examines the accuracy of the sum of 12 uniforms approach and suggests a
new algorithm that should be easy to implement in fixed point arithmetic.

"Dimiter" <dimiter@sonartech.com.au> wrote in message
news:d57cdd96.0310012139.1f668ad4@posting.google.com...
> Hi Guys, > > I need to generate gaussian white noise on an integer DSP. > > I have the fast Numerical Recipes generator but it has a log, a sqrt > and divides in it. > > Does anyone know where I can find one or where I can read about how to > write one? > > Thanks > > Dimiter
Stan Pawlukiewicz wrote:

> Dimiter wrote: >=20 >> Hi Guys, >> >> I need to generate gaussian white noise on an integer DSP. >> >> I have the fast Numerical Recipes generator but it has a log, a sqrt >> and divides in it. >> >> Does anyone know where I can find one or where I can read about how to=
>> write one? >> >> Thanks >> >> Dimiter >=20 >=20 > The simplest approximate method is to add 12 uniform independently=20 > distributed random numbers, subtract 6, and divide by 12. >=20 >=20
12 are enough, but it might be faster (and a smidgeon better) to add 16, subtract 8, then shift right 4 places. Jerry --=20 When a discovery is new, people say, "It isn't true." When it becomes demonstrably true, they say, "It isn't useful." Later, when its utility is evident, they say, "So what? It's old." a paraphrase of William James =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF= =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF= =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF
Jerry Avins wrote:

=2E..

> 12 are enough, but it might be faster (and a smidgeon better) to add 16=
,
> subtract 8, then shift right 4 places.
Adding half, then subtracting the other half gives zero mean directly. It means two loops, though, so it won't be faster unless the loop is=20 unrolled. Jerry --=20 "I view the progress of science as ... the slow erosion of the tendency to dichotomize." Barbara Smuts, U. Mich. =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF= =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF= =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF