📄 t_alpha.m
字号:
% % increased speed of program
% %
% % modified 8 March 2008 Implemented the analytical solution to the
% % cumulative probability function.
% % Maple was used to derive the solutions.
% %
% % modified 9 March 2008 Added additional analytical solutions
% % Updated comments.
% %
% % modified 11 September 2008 Updated Comments
% %
% % ***********************************************************
% %
% % Feel free to modify this code.
% %
if nargin < 1 || isempty(t) || ~isnumeric(t)
t=1;
end
if nargin < 2 || isempty(nu) || logical(nu < 1) || ~isnumeric(nu)
nu=Inf;
end
nu=round(nu(1));
% Check special cases of t
% set the values of alpha for the special cases
n1=length(t);
alpha=zeros(size(t));
ix=ismember(-Inf, t );
set_t=setdiff(1:n1, ix);
if ~isempty(ix)
alpha(ix)=0;
end
ix=ismember(Inf,t);
set_t=setdiff(set_t, ix);
if ~isempty(ix)
alpha(ix)=1;
end
ix=ismember(0,t);
set_t=setdiff(set_t, ix);
if ~isempty(ix)
alpha(ix)=0.5;
end
t=t(set_t);
% make sure t is not empty before checking special casaes of nu
if ~isempty(t)
% Check special cases of nu
% nu < 171 analytical solutions
% 171 <= nu <= 320 Generalized Hypergeometric solution
% nu >= 321 normal distribution approximation
switch nu
case 1;
alpha(set_t)=1./2+1./pi.*atan(t);
case 2;
alpha(set_t)=1./2+1./2.*t./(2+t.^2).^(1./2);
case 3;
alpha(set_t)=1./2+1./pi.*atan(1./3.*t.*3.^(1./2))+1./pi.*t.*3.^(1./2)./(3+t.^2);
case 4;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -