Main Archive Specials Wiki | FAQ Links Submit Forum

 Gaussian White noiseReferences : Posted by Alexey MenshikovNotes : Code I use sometimes, but don't remember where I ripped it from. - Alexey MenshikovCode : #define ranf() ((float) rand() / (float) RAND_MAX) float ranfGauss (int m, float s) { static int pass = 0; static float y2; float x1, x2, w, y1; if (pass) { y1 = y2; } else { do { x1 = 2.0f * ranf () - 1.0f; x2 = 2.0f * ranf () - 1.0f; w = x1 * x1 + x2 * x2; } while (w >= 1.0f); w = (float)sqrt (-2.0 * log (w) / w); y1 = x1 * w; y2 = x2 * w; } pass = !pass; return ( (y1 * s + (float) m)); }

 CommentsAdded on : 29/01/04 by davidchristenATgmxDOTnetComment : White Noise does !not! consist of uniformly distributed values. Because in white noise, the power of the frequencies are uniformly distributed. The values must be normal (or gaussian) distributed. This is achieved by the Box-Muller Transformation. This function is the polar form of the Box-Muller Transformation. It is faster and numeriacally more stable than the basic form. The basic form is coded in the other (second) post. Detailed information on this topic: http://www.taygeta.com/random/gaussian.html http://www.eece.unm.edu/faculty/bsanthan/EECE-541/white2.pdf Cheers DavidAdded on : 06/09/07 by nick[ DOT ]a[ DOT ]shaw[ AT ]btopenworld[ DOT ]comComment : I'm trying to implement this in C#, but y2 isn't initialized. Is this a typo?         Added on : 17/07/10 by foo[ AT ]bar[ DOT ]deComment : @nick: Way to late, but y2 will always be initialized as in the first run "pass" is 0 (i.e. false). The C# compiler just can't prove it.Added on : 03/09/11 by asynth[ AT ]gmail[ DOT ]comComment : David is wrong. The distribution of the sample values is irrelevant. 'white' simply describes the spectrum. Any series of sequentially independent random values -- whatever their distribution -- will have a white spectrum.Added on : 06/01/17 by aleyuwo[ AT ]popp[ DOT ]eamale[ DOT ]comComment : [url=http://dutasterideavodartonline.org/]dutasterideavodartonline.org.ankor[/url] online-purchaselevitra.net.ankor http://20mg-cheapest-pricelevitra.net/Added on : 06/01/17 by oboqamego[ AT ]g[ DOT ]eamale[ DOT ]comComment : [url=http://dutasterideavodartonline.org/]dutasterideavodartonline.org.ankor[/url] online-purchaselevitra.net.ankor http://20mg-cheapest-pricelevitra.net/

 Add your own comment Comments are displayed in fixed width, no HTML code allowed! Email: Comment: Are you human?

Site created and maintained by Bram
Graphic design by line.out | Server sponsered by fxpansion