WWEIBSTAT Mean and variance for the Weibull distribution. CALL: [m,v] = wweibstat(a,c) m, v = the mean and variance, respectively a, c = parameters of the Weibull distribution (see wweibcdf). Mean (m) and variance (v) for the Weibull distribution is m=a*gamma(1+1/c) and v=a^2*gamma(1+2/c)-m^2; Example: [m,v] = wweibstat(4,0.5) See also wweibcdf
Check if all input arguments are either scalar or of common size. | |
Display message and abort function. | |
Gamma function. | |
Not-a-Number. |
Joint 2D CDF computed as int F(X1 | |
Mean and variance for the DIST2D distribution | |
Mean and variance for the MDIST2D distribution. | |
Joint 2D Weibull cumulative distribution function | |
Mean and variance for the 2D Weibull distribution |
001 function [m,v]= wweibstat(a,c); 002 %WWEIBSTAT Mean and variance for the Weibull distribution. 003 % 004 % CALL: [m,v] = wweibstat(a,c) 005 % 006 % m, v = the mean and variance, respectively 007 % a, c = parameters of the Weibull distribution (see wweibcdf). 008 % 009 % Mean (m) and variance (v) for the Weibull distribution is 010 % 011 % m=a*gamma(1+1/c) and v=a^2*gamma(1+2/c)-m^2; 012 % 013 % Example: 014 % [m,v] = wweibstat(4,0.5) 015 % 016 % See also wweibcdf 017 018 019 % Reference: Cohen & Whittle, (1988) "Parameter Estimation in Reliability 020 % and Life Span Models", p. 25 ff, Marcel Dekker. 021 022 023 % Tested on; Matlab 5.3 024 % History: 025 % revised pab 23.10.2000 026 % - added comnsize 027 % added ms 15.06.2000 028 029 error(nargchk(2,2,nargin)) 030 031 [errorcode, a, c] = comnsize(a,c); 032 033 if errorcode > 0 034 error('a and c must be of common size or scalar.'); 035 end 036 037 % Initialize Mean and Variance to zero. 038 m = zeros(size(a)); 039 v = zeros(size(a)); 040 041 ok = (a > 0 & c > 0); 042 k = find(ok); 043 if any(k) 044 m(k) = a(k) .* gamma(1 + (1 ./ c(k))); 045 v(k) = a(k) .^ 2 .* gamma(1 + (2 ./ c(k))) - m(k).^ 2; 046 end 047 048 k1 = find(~ok); 049 if any(k1) 050 tmp = NaN; 051 m(k1) = tmp(ones(size(k1))); 052 v(k1) = m(k1); 053 end 054
Comments or corrections to the WAFO group