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