MATLAB: How to generate power-law random numbers

matlab functionpower lawprobability distributionsrandom number generator

Hi, I'm confused in generating power law random numbers. Now I'm using the following code for generating power law random numbers:
k = rand;
power_law = k^(1/-(alpha+1)); where 0 < alpha < 2.
I don't know if I'm following the correct way or not. Kindly help me.

Best Answer

What is the probability density function for the power law distribution you use ?
p(x)=(alpha-1)*x^(-alpha)
?
In this case, use
k=rand ;
power_law = (1-k)^(1/(-alpha+1))
Best wishes
Torsten.