Random number generation with equal length

I would like to generate random n-dimensional points with the same distance from the origin. i.e. norm(point) should be equal for all points... how can i achieve this?

 채택된 답변

John D'Errico
John D'Errico 2012년 6월 2일

0 개 추천

In n dimensions, to generate 1 such point...
X = randn(1,n);
X = X./norm(X);
To generate many such points, it is as easy a generating an array, then dividing each row by the norm of that row. sum and bsxfun will be of help here.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Random Number Generation에 대해 자세히 알아보기

태그

질문:

2012년 6월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by