Borrar filtros
Borrar filtros

generating a random variable with a given mean and matrix

3 visualizaciones (últimos 30 días)
can any one tell me how to generate a NORMAL DISTRIBUTION random variable X = N(mu,A), where mu is the mean (mu = 0, 0 mean) and A is a p*p IDENTITY MATRIX. Please ask me if the question is unclear. Thanks

Respuesta aceptada

Image Analyst
Image Analyst el 15 de Oct. de 2016
Like this?
numRows = size(A, 1);
A(logical(eye(numRows))) = randn(1, numRows)
  8 comentarios
fafz1203
fafz1203 el 15 de Oct. de 2016
I'm sorry but it turns out that I was wrong, Here is what I want to do I want to generate a random variable X (X~N(0,A)), that is it has 0 mean and A is a 10*10 covariance matrix which is a 10*10 identity matrix
now what i want to do is I want to generate a 10*1000 random variable X using the above information.
Please help me if you can. Thanks
Image Analyst
Image Analyst el 15 de Oct. de 2016
I don't believe you can do that and have the random variable be random. If it's random, you won't have A=eye(10) for the covariance matrix.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Random Number Generation en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by