close all

dexppdf = @(x, mu, lambda) 1/2 .* exppdf(  abs(x-mu), 1./lambda) ;
dexpcdf = @(x, mu, lambda) 1/2 + sign(x-mu)/2 .* expcdf(abs(x-mu), 1./lambda);
dexpinv = @(p,  mu, lambda) mu + sign(2*p-1) .* expinv(abs(2 * p - 1), 1./lambda);
dexprnd = @(mu,lambda,size)  mu + exprnd(1./lambda, size) - exprnd(1./lambda, size);
dexpstat =  @(mu, lambda)  deal(mu,  2./lambda.^2);
%
mu=6
lambda=0.2
x = mu-5/lambda:0.001:mu+5/lambda;
figure(1)
subplot(211)
 plot(x, dexppdf(x, mu, lambda));
 subplot(212)
 plot(x, dexpcdf(x,mu, lambda));
 figure(2)
 p = 0:0.001:1;
 plot(p, dexpinv(p, mu, lambda));
 rr=dexprnd(mu, lambda,[1000000 1]);
 mean(rr)
 var(rr)
 [m v]=dexpstat(mu, lambda)
 
