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