⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 custom_tinv.m

📁 toolbox of BVQX, This is the access between BV and matlab. It will help you to analysis data from BV
💻 M
字号:
function x = custom_tinv(p, v)
% custom_tinv  - returns inverse CDF of the Student's t-distribution
%
% FORMAT:       x = custom_tinv(p, v);
%
% Input fields:
%
%       p           CDF of t distribution with v d.f. at points x
%       v           d.f. of distribution function
%
% Output fields:
%
%       x           t-variate (Student's t has range (-Inf,Inf))

% Version:  v0.6f
% Build:    7070509
% Date:     Jul-05 2007, 9:51 AM CEST
% Author:   Alois Schloegl <a.schloegl@ieee.org>

% argument check
if nargin < 2 || ...
   ~isa(p, 'double') || ...
   ~isa(v, 'double') || ...
    isempty(v) || ...
    any(isnan(p(:))) || ...
    any(isinf(v(:)) | isnan(v(:)) | v(:) < 0)
    error( ...
        'BVQXtools:BadArgument', ...
        'Missing or invalid argument given.' ...
    );
end
if isempty(p)
    x = [];
    return;
end
osize = size(p);
if numel(p) == 1 && ...
    numel(v) > 1
    osize = size(v);
end
p = p(:);
v = v(:);

% calculus
x = reshape(...
    (sign(p - 1/2) .* sqrt(v ./ custom_betainv(2 * min(p, 1-p), v ./ 2, 1/2) - v)), ...
    osize);

⌨️ 快捷键说明

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