WFINV Inverse of the Snedecor's F distribution function CALL: x = wfinv(F,df1,df2) x = inverse cdf for the F distribution evaluated at F. df1, df2 = degrees of freedom (1,2,....) Example: F = linspace(0,1,100); x = wfinv(F,1,2); plot(F,x)
Check if all input arguments are either scalar or of common size. | |
Inverse of the Beta distribution function | |
Display message and abort function. | |
Not-a-Number. |
001 function x = wfinv(F,a,b) 002 %WFINV Inverse of the Snedecor's F distribution function 003 % 004 % CALL: x = wfinv(F,df1,df2) 005 % 006 % x = inverse cdf for the F distribution evaluated at F. 007 % df1, df2 = degrees of freedom (1,2,....) 008 % 009 % Example: 010 % F = linspace(0,1,100); 011 % x = wfinv(F,1,2); 012 % plot(F,x) 013 014 015 % tested on matlab 5.3 016 %History: 017 %revised pab 29.10.2000 018 % adapted from stixbox 019 % -added nargchk, comnsize 020 % Anders Holtsberg, 18-11-93 021 % Copyright (c) Anders Holtsberg 022 023 error(nargchk(3,3,nargin)) 024 [errorcode F,a,b] = comnsize(F,a,b); 025 if errorcode>0, 026 error('x, df1 and df2 must be of common size or scalar'); 027 end 028 029 x = zeros(size(F)); 030 031 ok = (a>0 & b>0 & floor(a)==a & floor(b)==b); 032 033 k = find(F>0&F<1 & ok); 034 if any(k) 035 tmp = wbetainv(F(k),a(k)/2,b(k)/2); 036 x(k) = tmp.*b(k)./((1-tmp).*a(k)); 037 end 038 039 040 k2=find(F==1&ok); 041 if any(k2) 042 x(k2)=inf; 043 end 044 045 046 k3=find(~ok); 047 if any(k3) 048 tmp=NaN; 049 x(k3)=tmp(ones(size(k3))); 050 end 051
Comments or corrections to the WAFO group