volsphere.m

来自「数据挖掘的工具箱,最新版的,希望对做这方面研究的人有用」· M 代码 · 共 30 行

M
30
字号
function V = volsphere(d,R,takelog)%VOLSPHERE Compute the volume of a hypersphere%%      V = VOLSPHERE(D,R)%% Compute the volume of a hypersphere in D dimensions, with radius R.%%      V = VOLSPHERE(D,R,TAKELOG)%% If TAKELOG>0 than the log(V) is computed (more useful for high% dimensions)%% Default: R=1; TAKELOG=0if nargin<3	takelog=0;endif nargin<2	R = 1;endif takelog	V = log(2) + d*log(R*sqrt(pi)) - log(d) - gammaln(d/2);else	V = 2*(R*sqrt(pi))^d/(d*gamma(d/2));endreturn

⌨️ 快捷键说明

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