using randn within an interval
Mostrar comentarios más antiguos
Hey Does anyone know of a way to create an mxn matrix of random normals where each entry is within an particular bound. For example each entry is a random normal greater than -1 but less than 2. Thanks
Respuesta aceptada
Más respuestas (1)
Andrei Bobrov
el 27 de Jun. de 2011
v1 = randn(m,n);
rndn12=1+(v1-min(v1(:)))/(max(v1(:))-min(v1(:)))
EDIT (06/27/2011 22:58 MSK)
itl = [-1 4]; % interval
v1 = randn(m,n);
rndn12=itl(1)+diff(itl)*(v1-min(v1(:)))/(max(v1(:))-min(v1(:)))
Categorías
Más información sobre Multivariate t Distribution en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!