- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want implement a white noise... I have made a C++ function to return a number between [0,sigma], where sigma is a standard deviation for the gauss distribuzion.
For noise generator I have use the functions following :
vslNewStream(&stream,VSL_BRNG_R250,1);
status1 = vdRngGaussian(VSL_METHOD_DGAUSSIAN_BOXMULLER,stream,N,vet,0,noise);
vslDeleteStream(&stream);
but it is not work, becouse the function return numbers negative and positive... my output is:
vet= [ -0.00002, 0.00005, -0.000018, ..... , -0.000077]
how do I do to make number to return between [0,sigma]?
help me please!
For noise generator I have use the functions following :
vslNewStream(&stream,VSL_BRNG_R250,1);
status1 = vdRngGaussian(VSL_METHOD_DGAUSSIAN_BOXMULLER,stream,N,vet,0,noise);
vslDeleteStream(&stream);
but it is not work, becouse the function return numbers negative and positive... my output is:
vet= [ -0.00002, 0.00005, -0.000018, ..... , -0.000077]
how do I do to make number to return between [0,sigma]?
help me please!
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Normally distributed random numbers which have mathematical expectation 0 andstandard deviation sigma can be both positive and negative -chances tohave negative outputare 0.5. To generate random numbers from interval [0, sigma] you may want to use another generator, for examplegenerator of uniformly distributedrandom numbers.Type of the generator to use depends on the requirements of your problem (in particular, type of white noise).
Also,when you make call to the Gaussian generator, please make sure to pass correct set of parameters to the routine:
status1 = vdRngGaussian(VSL_METHOD_DGAUSSIAN_BOXMULLER,stream,N,vet,0,sigma);
Thanks,Andrey
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page