Gaussian white noise code in C

  • Permalink
  • submit to reddit
  • Email
  • Follow


Hello all,

I'm in need of a C program which implements the Gaussian white noise
algorithm in C. The program is to accept a binary file as input and
alter it according to the algorithm.
I'm affraid this project must run on Windoze :( 
Thank you in advance

Jess
0
Reply jessex (1) 12/7/2003 9:48:52 AM

See related articles to this posting


"Jess" <jessex@kmfms.com> wrote in message
news:63bbea8b.0312070148.4a07e00@posting.google.com...
> Hello all,
>
> I'm in need of a C program which implements the Gaussian white noise
> algorithm in C. The program is to accept a binary file as input and
> alter it according to the algorithm.
> I'm affraid this project must run on Windoze :(

Jess,

What does Windows have to do with your question?  Presumably you have an
ANSI C compiler that's suitable for generating code that will run on the
usual platforms, no?

What does the "binary file as input" have to do with the question?  Are you
meaning to add the noise to the input data or.....?  If you intend to add
it, then you'll be concerned with scaling the noise to match the intended
application.  This includes the number represenation you'll be using (fixed,
floating, etc.)

Check out:
http://www.dspguru.com/howto/tech/wgn.htm
http://www.mathtools.net/Java/Random_numbers/C_and_C++/

Fred


0
Reply Fred 12/7/2003 7:51:10 PM

On Sun, 07 Dec 2003 09:48:52 +0000, Jess wrote:

> Hello all,
> 
> I'm in need of a C program which implements the Gaussian white noise
> algorithm in C. The program is to accept a binary file as input and
> alter it according to the algorithm.
> I'm affraid this project must run on Windoze :( Thank you in advance
> 


Although I have not tried it, white noise should have a flat spectrum.
You could try setting all values to 1 in a complex array and performing
an inverse FFT on it.

Possibly a tweak or two is in order.

This should be guaranteed white noise !
0
Reply Robin48gx 12/8/2003 12:05:35 AM

Robin48gx <robin48gx@hotmail.com> wrote in message > 
> Although I have not tried it, white noise should have a flat spectrum.
> You could try setting all values to 1 in a complex array and performing
> an inverse FFT on it.
> 
> Possibly a tweak or two is in order.
> 
> This should be guaranteed white noise !

Well, if you do this, you'll get an impulse - autocorrelation of white noise!

Kiran
0
Reply kiranatiisc 12/8/2003 4:21:37 AM

Robin48gx wrote:

> Although I have not tried it, white noise should have a flat spectrum.
> You could try setting all values to 1 in a complex array and performing
> an inverse FFT on it.
> 
> Possibly a tweak or two is in order.
> 
> This should be guaranteed white noise !

This can not be less white noise!!  This is not even noise!!
This is a deterministic signal!!

Maybe (and only *maybe* -- as in, I'm almost sure that it
won't work, but there's a slight chance that it might) if
you set the magnitudes of the FFT to 1, and set the phase
to uniformly distributed random values between -pi and pi...
Maybe you'll get something similar to white noise...

And BTW, how do you expect this to produce *Gaussian* white
noise?  How do you know that it's not going to be uniformly
distributed white noise?

Carlos
--

0
Reply Carlos 12/8/2003 5:49:44 AM

Robin48gx wrote:

> On Sun, 07 Dec 2003 09:48:52 +0000, Jess wrote:
> 
> 
>>Hello all,
>>
>>I'm in need of a C program which implements the Gaussian white noise
>>algorithm in C. The program is to accept a binary file as input and
>>alter it according to the algorithm.
>>I'm affraid this project must run on Windoze :( Thank you in advance
>>
> 
> 
> 
> Although I have not tried it, white noise should have a flat spectrum.
> You could try setting all values to 1 in a complex array and performing
> an inverse FFT on it.
> 
> Possibly a tweak or two is in order.
> 
> This should be guaranteed white noise !

Don't offer guarantees too freely. With one set of phases, it could be
the spectrum of an impulse. With another, of a chirp. Anyhow, summing 12 
to 20 random numbers is easier than a broadband IFFT.

Jerry
-- 
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������

0
Reply Jerry 12/8/2003 4:52:41 PM

What you need to search for is the Box-Muller algorithm. So simpe that even
the meanest programmer should be able to implement it in C.

Nick Felgate

"Jess" <jessex@kmfms.com> wrote in message
news:63bbea8b.0312070148.4a07e00@posting.google.com...
> Hello all,
>
> I'm in need of a C program which implements the Gaussian white noise
> algorithm in C. The program is to accept a binary file as input and
> alter it according to the algorithm.
> I'm affraid this project must run on Windoze :(
> Thank you in advance
>
> Jess


0
Reply Nick 12/12/2003 1:28:42 AM
comp.dsp 19844 articles. 22 followers. Post

6 Replies
975 Views

Similar Articles

[PageSpeed] 51


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Code for White Gaussian Noise Generator
Hi all, i am stuck up with generating code for white gaussian noise generator with variable output noise and variable variance. I designed the code using Monte-Carlo simulation, x(n+1)=[Bx(n) + u][mod P] and then generating random variables U1 and U2 such that, U1=sqrt(-2lnX1) * cos(2pi X2) U1=sqrt(-2lnX1) * sin(2pi X2) but U1 and U2 are having variance 1 and i need variable variance... can anyone please help with this problem !! thanks, cheers... "Amar" <pathak_amar@hotmail.com> wrote in message news:dp1wy1vnh80u@legacy... > Hi all, > i am st...

Audio jamming using white gaussian noise (matlab code)
Hi anybdy have any idea how can a baseband audio sound can be supressed or jammed using a white gaussian noise and how the result can be shown in Matlab. any help will be appreciated. -Shruti ...

Adding White Noise (Gaussian Noise) To a Set of 3D Points
Hi All, Could somebody please tell me how I would go about adding white noise to a set of 3d points. I am looking to implement this in c++ so if anybody already has a library or some code snippet as an example it would be much appreiciated. Adam "Adam Hartshorne: > Could somebody please tell me how I would go about adding white noise to > a set of 3d points. Could you please explain what do you mean by adding noise to a set of points? You mean: jitter the coordinates? Or what? Anyway, white noise is an ultralocal distribution, for different points its values are *unc...

Adding White Noise (Gaussian Noise) To A Set Of 3D Points
Hi All, Could somebody please tell me how I would go about adding white noise to a set of 3d points. I am looking to implement this in c++ so if anybody already has a library or some code snippet as an example it would be much appreiciated. Adam Adam Hartshorne wrote: > Could somebody please tell me how I would go about adding white noise > to a set of 3d points. I am looking to implement this in c++ so if > anybody already has a library or some code snippet as an example it > would be much appreiciated. You might want to look in the archives for "Availabe C++ Librar...

How to add white gaussian noise or any other noise in sgnal waveform and normlize it?
In one signal waveform has been normalized by flicker noise as below. f= 0:100; % frequency points fn = 100; % Nyquist rate F= f/fn; % frequency vector M= abs(100./sqrt(f)); % normalized fequency response M= [zeros(1,6),M(6:100)]; % bound from zero frequency [b1,a1] = yulewalk(3,F,M); % generate order=3 filter And then using this b1,a1 co efficient graph has been drawn, I want to do same thing using any other noise like white Gaussian noise or other, how can I do it? I am from IT back ground so don't know well how to play with signals, please help.... Have you looked at...

will subsampled 2-D Gaussian White noise still be white?
Hi, everyone: I generated a 2-D matrix with spatially-uniform Gaussian White noise. Then I fourier transformed the matrix to frequency domain, and sub-sampled it by a factor of 4. Since the the sampling rate is only 1/4 of Nyquist, there will be aliasing in the new matrix. So the new noise distribution is no longer spatially uniform. But will this non-uniform spatial distribution change the power spectrum density of original white noise? Can I say that the resultant noise is not white noise? Thanks a lot! On Sep 1, 5:19=A0am, "sheng fang" <maelstro...@gmail.com> wrot...

White Gaussian Noise
I want to add white Gaussian noise of four intensities (i.e. 1%, 2%, 5% and 10% noise to signal ratio) to impact force signals and the acceleration response time histories. Can anyone give me a help? "Rupika Bandara" <rupika23@yahoo.com> wrote in message <hrd378$4e$1@fred.mathworks.com>... > I want to add white Gaussian noise of four intensities (i.e. 1%, 2%, 5% and 10% noise to signal ratio) to impact force signals and the acceleration response time histories. Can anyone give me a help? if you have communications toolbox: doc awgn doc wgn On Apr 30, 11:03=A0...

question about white gaussian noise
does additive white gaussian noise only change the amplitude of a signal or does it change both amplitude and phase? "bamse" <bamse@kyllingen.dkkkk> wrote in message news:<6BEnc.4$NS3.3@news.get2net.dk>... > does additive white gaussian noise only change the amplitude of a signal or > does it change both amplitude and phase? There are two ways of looking at Gaussian noise: Time domain: Random numbers are drawn from a Gaussian distribution and added to the samples in the signal, thus "changing the amplitude" of the individual samples. Frequency domain...

additive white Gaussian noise
Hello all please help me ; If I want to generate the following signal x= u*h ; y= x+ n ; u=[1 1 1 1 -1 -1 -1 -1 ] ; h= random('rayl',1,8 ) ; I want the signal to noise ration to be 5 dB ; I am generating 8 random Rayleigh fading envelopes and multiplying them by 1 or -1 according the the Hypothesis ( In wireless sensor Network ) ; Will I have to use var(x) ... to calculate the signal power and after that calculating the required noise power ? In some references they use the following formula : SNR= mean(x)/ std(n) In the paper which I am trying to implem...

White Gaussian Noise Generation
Hi, I'm having trouble with the randn function. I'm trying to generate a white gaussian noise from -10<a<10 with zero mean and variance 1. I did the following: a=-10:10; noise=randn(size(a)); However, this doesn't seem to be correct. The noise that i get when i plot it, doesn't start at -10, it starts at zero. How can I shift it so that it goes from -10 to 10? Another question, when I check the mean and variance of the signal using the following: meannoise = mean(noise); varnoise = var(noise); The result that I get is not 0 mean and variance 1, why is that? I thought...

white gaussian noise #3
hello, need urgent help. can someone explain me how does the white gaussian noise works?...how can i simulate such a signal???... thank you, Artur "Artur Racu" <arturracu@yahoo.com> wrote in message <hrnhb0$s8i$1@fred.mathworks.com>... > hello, > > need urgent help. can someone explain me how does the white gaussian noise works?...how can i simulate such a signal???... > > > thank you, > > Artur if you have communications toolbox doc awgn doc wgn No toolbox doc randn "ade77 " <ade100a@gmail.com> w...

question about white gaussian noise
does additive white gaussian noise only change the amplitude of a signal or does it change both amplitude and phase? Going from off the top of my head here, so correct me if I am up the garden path on a frosty morn. Gaussian noise is continuous frequency spectrum (ie not discrete frequencies) at random positions in time, thus should not have a phase. As far as the amplitude goes, if you multiply noise by 2, its amplitude becomes larger (doubles). And, if you add it to itself, with no time delay, then it is the same as multiplying by 2. However, if you add 2 seperate lots of equivalent am...

How to generate White gaussian noise
Is there any inbuilt function or code available to generate white gaussian noise of desired mean and variance Hitansu Sahoo wrote: > > > Is there any inbuilt function or code available to generate white > gaussian noise of desired mean and variance Well, you could do it with mvrnd, but it might be easier to simply use N = randn(n_points,1).*sqrt(desired_variance)+desired_mean; Temu ...

additive white gaussian noise
Hi Does anyone know the algorithm or have a source code for applying Additive white gaussian noise? thanx very much -M- Mesvak wrote: > Does anyone know the algorithm or have a source code for applying > Additive white gaussian noise? For algorithms also try 'comp.programming'. Another newsgroup to visit for math stuff is 'sci.math.num-analysis'. Here we mostly discuss C++ language issues, and dispensation of algorithms and sources is usually done elsewhere. Like the Web. FYI. V -- Please remove capital 'A's when replying by e-mail I do not respond t...

Feedback white gaussian noise
I'm working on a GUI for PID tuning. My prof told me to add white gaussian noise with variable mean and variance. But I work with tranfer functions and I NEED to know the transfer function of the noise to close the loop and watch controller and filter's action. This can be easily done with Simulink, but I would have to change radically my GUI..please tell me there's another way.. TNX ANTRO ...

gaussian white noise generation
hello can any one please suggest me how to generate guassian white noise with zero mean and variance 1 in matlab? thanks. "sita" <swethapriyanka@gmail.com> wrote in message news:1137566793.060472.127900@f14g2000cwb.googlegroups.com... > hello > > can any one please suggest me how to generate guassian white noise with > zero mean and variance 1 in matlab? > > thanks. > If you have uniform distributed noise you can take say 12 samples and average them then subtract the dc level.This should be approx Guassian.Repeat process for every 12 samples giving one...

aboute white gaussian noise
Hi, I used wgn function generate a white Gaussian noise sequences. I had thought the sequences' spectrum is like a white noise , but I finded that the spectrum is like noise. This confuse me much . Could you comment on this? Thanks a lot. here is how I call wgn function: my_noise=wgn(1,1024,1,'linear'); "agump xiaoyong" <agump123@gmail.com> wrote in message news:gjfde6$m9r$1@fred.mathworks.com... > Hi, I used wgn function generate a white Gaussian noise sequences. I had > thought the sequences' spectrum is like a white noise , but I finded >...

Gaussian White Noise
Hi everybody, I want to call the "Gaussian White Noise.vi" several times (lets say, in a loop) and thereby, I want to fully control the state of the random generator which is used in the VI. I think, that the "seed" input somehow determines the state of internal random generator (which is unfortunately "hidden" in a DLL). So, what I would like to have is an output parameter that returns the last state of the random generator . The idea is, that I can call the VI several times setting the "seed" input parameter equal to the state of the random generator o...

Interpolation and the additive white gaussian noise
Dear all, The following problem recently came up in one of my simulations. I have a PSK modulated RRC filtered signal that I have to transmit over the AWGN channel. Before RRC filtering, I interpolate the IQ signal to twice the Nyquist rate. Now consider the two setups: The first one transmits the RRC filtered signal at twice the Nyquist rate, and adds white Gaussian noise to it. The second setup takes the RRC filtered signal, interpolates it by some N, and then adds white Gaussian noise to it. In matlab: % Code can be copied and run in matlab % May be you will need the communication toolbox...

Average power of White Gaussian Noise
Hi everyone! I'm trying to calculate the average power of a White Gaussian Noise signal (mean 0, variance 1). All the information I have found is referenced to Power Spectrum Density through "Pwelch" function. Please Help. Best regards, Alejandro ferminreyes@cantv.net The answer, my friend, is sitting there in your question. You don't need Matlab, you need a textbook on elementary spectral analysis. Derek See the thread "Power Spectrum Scaling" Hope this helps. Greg Alejandro wrote: > Hi everyone! > I'm trying to calculate the average pow...

How to generate Gaussian white process noise
How can we generate gaussian white process noise in matlab? Hi Mohan, Please see help randn and help awgn By the way, how you tried google'ing it? You can find lots of stuff. Best. "mohan meena" <mohanmeena123@gmail.com> wrote in message <hnfjta$4gu$1@fred.mathworks.com>... > How can we generate gaussian white process noise in matlab? "mohan meena" <mohanmeena123@gmail.com> wrote in message <hnfjta$4gu$1@fred.mathworks.com>... > How can we generate gaussian white process noise in matlab? >>doc randn If you have the Commun...

Additive White Gaussian Noise Question
My understanding is that when you add AWGN to a carrier, you make the amplitude a gaussian distribution, and then add white noise to this (not really pure white noise, but as high a BW as your simulation can handle). However, if you amplitude modulate a carrier by any AM % modulation, then your Fourier transform will show side bands which will not be spectrally flat like the added white noise. (this indicates how we get AM-to-PM effects, and also makes AM seem a bit of a misnomer, because in actuality you still alter the frequency spectrum. Whereas you can strip the AM off an FM signal, and ...

Generating non-gaussian white noise
I am trying to generate a 2-d white noise sequence whose first 4 moments (mean, std dev, skewness, kurtosis) are given. In general, the desired distribution is non-gaussian. One way to do this is to generate a gaussian sequence and then use a nonlinear transformation. 1. I'm wondering if there're any standard codes that do this. 2. If not, I am having trouble with the translation because matlab's 'randn' does not yield results close enough to gaussian, and for high high desired kurtosis values , the nonlinear transformation (e.g. a hyperbolic function) d...

white Gaussian noise #2 793278
HI May i Know how to introduce white Gaussian noise into speech signal using matlab and how can we change the amplitude of the white Gaussian noise? thanx you ivan look at this recent exposee by CSSMer <rune allnor> <http://groups.google.com/groups?hl=en&lr=lang_en&ie=UTF-8&oe=UTF-8&safe=off&selm=f56893ae.0307040948.aedb1a2%40posting.google.com> us Ivan Low: <SNIP wants to introduce white Gaussian noise into his/her speech signal...> ...