📄 volsphere.m
字号:
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 computations% in high dimensional feature spaces)%% Default: R=1; TAKELOG=0% Copyright: D.M.J. Tax, D.M.J.Tax@prtools.org% Faculty EWI, Delft University of Technology% P.O. Box 5031, 2600 GA Delft, The Netherlandsif 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -