function [m,v] = expstat(mu)
%EXPSTAT Mean and variance of the exponential distribution.
%   [M,V] = EXPSTAT(MU) returns the mean and variance 
%   of the exponential distribution with parameter MU.

%   References:
%      [1]  M. Abramowitz and I. A. Stegun, "Handbook of Mathematical
%      Functions", Government Printing Office, 1964, 26.1.28.

%     Copyright 1993-2000 The MathWorks, Inc. 
%     $Revision: 2.10 $  $Date: 2000/05/26 17:28:54 $


if nargin <  1, 
    error('Requires one input argument.'); 
end

[errorcode mu] = distchck(1,mu);

if errorcode > 0
    error('Requires non-scalar arguments to match in size.');
end

m  = mu;
v = mu .^ 2;

% Return NaN if B < 0. 
k = find(mu <= 0);
if any(k)
    tmp = NaN; 
    m(k)  = tmp(ones(size(k)));
    v(k) = m(k);
end
