Home Gaussian Random Signal with mean 0 and variance 1
Reply: 2

Gaussian Random Signal with mean 0 and variance 1

Ali Bassam
1#
Ali Bassam Published in 2013-04-08 17:07:18Z

I need to generate a Gaussian Random Signal using the randn function, with mean 0 and variance 1.

After using help randn I found many ways to use the randn function.

RANDN Normally distributed pseudorandom numbers. R = RANDN(N) returns an N-by-N matrix containing pseudorandom values drawn from the standard normal distribution. RANDN(M,N) or RANDN([M,N]) returns an M-by-N matrix. RANDN(M,N,P,...) or RANDN([M,N,P,...]) returns an M-by-N-by-P-by-... array. RANDN returns a scalar. RANDN(SIZE(A)) returns an array the same size as A.

This only says that parameters define if I could say, the matrix, or size, of the signal.

What is the correct way of generating this signal with mean 0 and variance 1?

And What should I change if I would like to change the mean and the variance?

WhitAngl
2#
WhitAngl Reply to 2013-04-08 17:10:33Z

a "standard normal distribution" already has mean zero and variance 1.

If you want to change the mean, just "translate" the distribution, i.e., add your mean value to each generated number. Similarly, if you want to change the variance, just "scale" the distribution, i.e., multiply all your numbers by sqrt(v).

fpe
3#
fpe Reply to 2013-04-08 20:16:44Z

you could also call

normrnd(0,1,[M,N])

or

random('Normal',0,1,[M,N])
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.664969 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO