WEXPINV Inverse of the Exponential distribution function CALL: x = wexpinv(F,m) x = inverse cdf for the Exponential distribution evaluated at F m = mean, m>0 Example: F = linspace(0,1,100); x = wexpinv(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 an Exponential distribution |
001 function x = wexpinv(F,m) 002 %WEXPINV Inverse of the Exponential distribution function 003 % 004 % CALL: x = wexpinv(F,m) 005 % 006 % x = inverse cdf for the Exponential distribution evaluated at F 007 % m = mean, m>0 008 % 009 % Example: 010 % F = linspace(0,1,100); 011 % x = wexpinv(F,1); 012 % plot(F,x) 013 014 % Reference: Johnson, Kotz and Balakrishnan (1994) 015 % "Continuous Univariate Distributions, vol. 1", p. 494 ff 016 % Wiley 017 018 019 % Tested on; Matlab 5.3 020 % History: 021 % revised pab 24.10.2000 022 % - added comnsize, nargchk 023 % added ms 10.08.2000 024 025 error(nargchk(2,2,nargin)) 026 %if nargin<2|isempty(m), m=0; end 027 028 [errorcode, F, m] = comnsize (F,m); 029 if (errorcode > 0) 030 error ('F and m must be of common size or scalar'); 031 end 032 033 x=zeros(size(F)); 034 ok = ((m>0)&(F>=0)&(F<=1)); 035 k = find (F<1& ok); 036 if any(k) 037 x(k)=-m(k).*log(1-F(k)); 038 end 039 040 041 k1 = find (~ok); 042 if any (k1) 043 tmp=NaN; 044 x(k1) = tmp(ones(size(k1))); 045 end 046 k2 = find (ok & F==1); 047 if any (k2) 048 tmp=inf; 049 x(k2) = tmp(ones(size(k2))); 050 end 051
Comments or corrections to the WAFO group