Borrar filtros
Borrar filtros

Generate a random data with fix mean

2 visualizaciones (últimos 30 días)
Ahmed Hussein
Ahmed Hussein el 7 de En. de 2014
Comentada: Image Analyst el 7 de En. de 2014
I have a matrix with 360 elements and I need to expand it to 3600 elements with the same mean and standard deviation.

Respuesta aceptada

Wayne King
Wayne King el 7 de En. de 2014
Editada: Wayne King el 7 de En. de 2014
You don't say the size of your matrix, you just tell us the number of elements. You also do not give us any information about the distribution -- is it Gaussian?
Xstart = randn(360,1);
meanX = mean(Xstart);
stdX = std(Xstart);
Xend = [Xstart ; stdX*randn(3600-360,1)+meanX];
  2 comentarios
Ahmed Hussein
Ahmed Hussein el 7 de En. de 2014
Thank you very much
Image Analyst
Image Analyst el 7 de En. de 2014
Of course repmat() also meets the requirements (or lack thereof).
vector3600 = repmat(vector360, [1, 10]);

Iniciar sesión para comentar.

Más respuestas (2)

Ahmed Hussein
Ahmed Hussein el 7 de En. de 2014
The matrix is [1,360] and the distribution is Gaussian
Thank you very much

Ahmed Hussein
Ahmed Hussein el 7 de En. de 2014
Thank you very much

Categorías

Más información sobre Particle & Nuclear Physics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by