using randn within an interval
이전 댓글 표시
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
채택된 답변
추가 답변 (1개)
Andrei Bobrov
2011년 6월 27일
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(:)))
카테고리
도움말 센터 및 File Exchange에서 Multivariate t Distribution에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!