t_alpha.m

来自「我认为很不错的语音处理的matlab源代码」· M 代码 · 共 368 行 · 第 1/5 页

M
368
字号
% %                              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 + =
减小字号Ctrl + -
显示快捷键?