% h1p45.m = randomgen.m - randomly generate N values and estimate (mu,s)
%                         from Exp(4), N(128,2500), respectively
N=1024;
L=1:N;
X=random('Exponential',4,N,1);
Y=random('Normal',128,50,N,1);
[mean(X), var(X)]
[mean(Y), std(Y)]
var(Y)
subplot(2,1,1)
X2=0.25*exp(-X./4);
plot(X,X2,'b.')
subplot(2,1,2)
Y2=exp(-(Y-128).*(Y-128)/(2*2500))/sqrt(2*pi)/50;
plot(Y,Y2,'r.')