function probs=lognordensity(mu,sigma,n) % Finds the n-vector of densities on the integers 1,...,n % normalized to sum to 1, for the lognormal with parameters % mu and sigma. probs=zeros(1,n); for i=1:n probs(i)=exp(-0.5*((log(i)-mu)/sigma)^2)/(sigma*i); end s=sum(probs); for i=1:n probs(i)=probs(i)/s; end