Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

zero mean white noise generation in matlab

594 views
Skip to first unread message

naidu

unread,
Mar 22, 2006, 8:28:40 AM3/22/06
to
i want to generate a zero mean white noise in matlab if u know please
kindly help me

Markus Pichler

unread,
Mar 22, 2006, 8:52:52 AM3/22/06
to

to generate N samples of zero-mean white noise use either

rand(N, 1)-0.5
randn(N, 1)

depending on whether the noise should be normally or Gaussian
distributed.

Markus

Ken Davis

unread,
Mar 22, 2006, 12:41:00 PM3/22/06
to
"Markus Pichler" <m.pi...@icie.jku.at> wrote in message
news:ef2d...@webx.raydaftYaTP...

Actually normally IS Gaussian. rand generates uniformly distributed noise
with mean 0.5. randn generates normal/Gaussian noise.


Markus Pichler

unread,
Mar 23, 2006, 3:09:40 AM3/23/06
to
> Actually normally IS Gaussian. rand generates uniformly distributed
> noise
> with mean 0.5. randn generates normal/Gaussian noise.

of course you're right - I meant to write 'uniformly' instead of
'normally'

Markus

Shachi P

unread,
Sep 22, 2011, 8:43:28 AM9/22/11
to
"Markus Pichler" <m.pi...@icie.jku.at> wrote in message <ef2d...@webx.raydaftYaTP>...
how to specify the standard deviation or variance?

Wayne King

unread,
Sep 22, 2011, 8:53:10 AM9/22/11
to
"Shachi P" wrote in message <j5fahg$sps$1...@newscl01ah.mathworks.com>...
If X is a random variable, then aX for some constant a has variance a^2 Var(X).

Therefore, scale the randn() vector by the standard deviation you want.

x = sqrt(2)*randn(1e3,1);

has variance 2.

Wayne

HAMAYOUN AHMAD

unread,
Aug 19, 2017, 6:18:17 AM8/19/17
to
naidu <naidu...@gmail.com> wrote in message <ef2d3...@webx.raydaftYaTP>...
> i want to generate a zero mean white noise in matlab if u know please
> kindly help me
You can use this function.

vstd = .5; %Standrad daviaition of white noise
vmean = 0; %mean of noice
N=10000;
rd=sqrt(vstd^2*12)*rand(N,1)-sqrt(vstd^2*12)/2;
mean(rd)
std(rd)
0 new messages