You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
% X = CHI2INV_RTB(P, N) is the inverse chi-squared cdf function of N-degrees of freedom.
4
+
%
5
+
% Notes::
6
+
% - only works for N=2
7
+
% - uses a table lookup with around 6 figure accuracy
8
+
% - an approximation to chi2inv() from the Statistics & Machine Learning Toolbox
9
+
%
10
+
% See also chi2inv.
11
+
12
+
% Copyright (C) 1993-2017, by Peter I. Corke
13
+
%
14
+
% This file is part of The Robotics Toolbox for MATLAB (RTB).
15
+
%
16
+
% RTB is free software: you can redistribute it and/or modify
17
+
% it under the terms of the GNU Lesser General Public License as published by
18
+
% the Free Software Foundation, either version 3 of the License, or
19
+
% (at your option) any later version.
20
+
%
21
+
% RTB is distributed in the hope that it will be useful,
22
+
% but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+
% GNU Lesser General Public License for more details.
25
+
%
26
+
% You should have received a copy of the GNU Leser General Public License
27
+
% along with RTB. If not, see <http://www.gnu.org/licenses/>.
28
+
%
29
+
% http://www.petercorke.com
30
+
31
+
functionf= chi2inv_rtb(confidence, n)
32
+
33
+
assert(n==2, 'chi2inv_rtb: only valid for 2DOF');
34
+
35
+
c = linspace(0,1,101);
36
+
37
+
% build a lookup table:
38
+
%x = chi2inv(c,2)
39
+
%fprintf('%f ');
40
+
41
+
% use the lookup table
42
+
x = [0.0000000.0201010.0404050.0609180.0816440.1025870.1237510.1451410.1667630.1886210.2107210.2330680.2556670.2785240.3016460.3250380.3487070.3726590.3969020.4214420.4462870.4714450.4969230.5227300.5488740.5753640.6022100.6294210.6570080.6849810.7133500.7421270.7713250.8009550.8310310.8615660.8925740.9240710.9560720.9885931.0216511.0552651.0894541.1242381.1596371.1956741.2323721.2697571.3078531.3466891.3862941.4267001.4679381.5100451.5530581.5970151.6419611.6879401.7350011.7831961.8325811.8832171.9351681.9885052.0433022.0996442.1576192.2173252.2788692.3423662.4079462.4757492.5459312.6186672.6941472.7725892.8542332.9393523.0282553.1212953.2188763.3214623.4295973.5439143.6651633.7942403.9322264.0804424.2405274.4145504.6051704.8158915.0514575.3185205.6268215.9914656.4377527.0131167.8240469.210340Inf];
0 commit comments