function f = Rayleigh_pdf(X,muX)
% f = Rayleigh_pdf(X,muX)
% return PDF of Rayleigh distribution  with mean muX at points X
 
%    Reference: http://en.wikipedia.org/wiki/Rayleigh_distribution

  modeX = muX*sqrt(2/pi); 

  idx = find(X<=0);
  X(idx) = 0.01;

  f = (X/modeX^2) .* exp(-0.5*(X/modeX).^2); 

% ------------------------------------------------------------ Rayleigh_pdf
