WEXPCDF Exponential cumulative distribution function CALL: F = wexpcdf(x,m); F = distribution function evaluated at x m = mean The Exponential distribution is defined by its cdf F(x)=1-exp(-x/m), x>=0, m>0. Example: x = linspace(0,6,200); p1 = wexpcdf(x,1); p2 = wexpcdf(x,2); plot(x,p1,x,p2)
Check if all input arguments are either scalar or of common size. | |
Display message and abort function. | |
Not-a-Number. |
Parameter estimates for Exponential data. |
001 function F = wexpcdf(x,m); 002 %WEXPCDF Exponential cumulative distribution function 003 % 004 % CALL: F = wexpcdf(x,m); 005 % 006 % F = distribution function evaluated at x 007 % m = mean 008 % 009 % The Exponential distribution is defined by its cdf 010 % 011 % F(x)=1-exp(-x/m), x>=0, m>0. 012 % 013 % Example: 014 % x = linspace(0,6,200); 015 % p1 = wexpcdf(x,1); p2 = wexpcdf(x,2); 016 % plot(x,p1,x,p2) 017 018 % Reference: Johnson, Kotz and Balakrishnan (1994) 019 % "Continuous Univariate Distributions, vol. 1", p. 494 ff 020 % Wiley 021 022 % Tested on; Matlab 5.3 023 % History: 024 % revised pab Dec2003 025 % fixed abug: k1 ->k3 026 % revised pab 24.10.2000 027 % - added comnsize, nargchk 028 % added ms 15.06.2000 029 030 error(nargchk(2,2,nargin)) 031 [errorcode x m] = comnsize(x,m); 032 if errorcode > 0 033 error('x and m must be of common size or scalar.'); 034 end 035 036 % Initialize f to zero. 037 F = zeros(size(x)); 038 039 k=find(x >= 0 & m>0); 040 if any(k), 041 F(k)=1-exp(-x(k)./m(k)); 042 end 043 044 k3 = find(m<=0); 045 if any(k3) 046 tmp = NaN; 047 F(k3) = tmp(ones(size(k3))); 048 end 049
Comments or corrections to the WAFO group