unitrand.m
来自「wekaUT是 university texas austin 开发的基于wek」· M 代码 · 共 14 行
M
14 行
function sample = unitrand(dim)% UNITRAND Generate unit random vector in dim dimensions% % SAMPLE = UNITRAND(DIM) Generates a unit random vector that% comes from a uniform distr on the unit 'dim' dimensional sphere.% The method used is: generate N normally distr numbers, form a% vector and normalize to be of unit length!% % See: HAKMEN Item 27sample = randn(dim,1);n = norm(sample);sample = sample/n;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?