test_rand_uniform_inside_hypersphere.m

来自「一个用EM算法的源程序」· M 代码 · 共 36 行

M
36
字号
% A test function for test_rand_uniform_inside_hypersphere.m%subplot(1,3,1)figure(1)X = zeros(1,100);ticX = rand_uniform_inside_hypersphere(1,100);tocplot(X(1,:),X(1,:), 'bo')figure(2)%subplot(1,3,2)X = ones(2,400);ticX = rand_uniform_inside_hypersphere(2,400);tocplot(X(1,:),X(2,:),'b.');figure(3)%subplot(1,3,3)X = zeros(3,4000);ticX = rand_uniform_inside_hypersphere(3,4000);tocplot3(X(1,:),X(2,:),X(3,:),'b.');% % Figure out which kind of random number is easier to generate.% pointCount = 2000;% X = zeros(2000);% tic% X = rand(2000);% toc% tic% X = randn(2000);% toc% % Uniform generation is actually a little slower than normal distribution.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?