WRAYLINV Inverse of the Rayleigh distribution function CALL: x = wraylinv(F,b) x = inverse cdf for the Rayleigh distribution evaluated at F b = parameter The Rayleigh distribution is defined by its cdf F(x;b) = 1 - exp(-x^2/(2b^2)), x>=0 Example: F = linspace(0,1,100); x = wraylinv(F,1); plot(F,x)
Check if all input arguments are either scalar or of common size. | |
Display message and abort function. | |
Not-a-Number. |
Random matrices from a Rayleigh distribution |
001 function x = wraylinv(F,b) 002 %WRAYLINV Inverse of the Rayleigh distribution function 003 % 004 % CALL: x = wraylinv(F,b) 005 % 006 % x = inverse cdf for the Rayleigh distribution evaluated at F 007 % b = parameter 008 % 009 % The Rayleigh distribution is defined by its cdf 010 % 011 % F(x;b) = 1 - exp(-x^2/(2b^2)), x>=0 012 % 013 % 014 % Example: 015 % F = linspace(0,1,100); 016 % x = wraylinv(F,1); 017 % plot(F,x) 018 019 020 % Reference: Cohen & Whittle, (1988) "Parameter Estimation in Reliability 021 % and Life Span Models", p. 181 ff, Marcel Dekker. 022 023 % Tested on: Matlab 5.3 024 % History: 025 % revised pab 24.10.2000 026 % - added comnsize, nargchk 027 % added ms 15.06.2000 028 029 030 error(nargchk(2,2,nargin)) 031 032 [errorcode, F, b] = comnsize(F,b); 033 if (errorcode > 0) 034 error ('F and b must be of common size or scalar'); 035 end 036 037 x=zeros(size(F)); 038 039 040 k = find ((F == 1) & (b>0)); 041 if any (k), 042 tmp=inf; 043 x(k) = tmp(ones (size(k))); 044 end 045 046 k1 = find ((F > 0) & (F < 1) & (b>0)); 047 if any (k1), 048 x(k1)=sqrt(-2*log(1-F(k1))).*b(k1); 049 end 050 051 k2 = find(F<0 | F>1 | (b<=0)); 052 if any(k2), 053 tmp=NaN; 054 x(k2)=tmp(ones(size(k2))); 055 end 056 057 058
Comments or corrections to the WAFO group