Hi ben,
Sorry that I can't reply soon enough. This issue might be due to the fact that your pdf spread quite narrow, and the code detect the probability to produce points beyond that region is lower than 1e-4, this is to make the code more efficient, however, you can modify line 68 and 73, to set this threshold smaller (however, the method I chose can't handle values smaller than eps.)
Y. Hu

Hi ben,
Sorry for the late reply. You're right about the expression for Gaussian distribution, however, you can easily generate a Gaussian PDF random number from the built-in random number generator, while my file is design specifically for PDFs that don't have a built-in generator. So I wrote an example of PDF in case that you don't know how to use the code and just execute it without any input arguments. One property of my code is that it can normalise the PDF automatically, so you don't need to worry about the normalisation constant.
Y. Hu

Hi ben,
Sorry that I can't reply soon enough. This issue might be due to the fact that your pdf spread quite narrow, and the code detect the probability to produce points beyond that region is lower than 1e-4, this is to make the code more efficient, however, you can modify line 68 and 73, to set this threshold smaller (however, the method I chose can't handle values smaller than eps.)
Y. Hu

Hi Hu,
i need to generate a sample of 1-D random numbers in [-10,10] which follows the PDF of Levy distribution. So i use your code. The problem that the resulting values are in the new range [-3.9394,3.9394] but i want that these values are in the original range including xmin=-10 and xmax=10.can you help me please?
thank you

Hi ben,
Sorry for the late reply. You're right about the expression for Gaussian distribution, however, you can easily generate a Gaussian PDF random number from the built-in random number generator, while my file is design specifically for PDFs that don't have a built-in generator. So I wrote an example of PDF in case that you don't know how to use the code and just execute it without any input arguments. One property of my code is that it can normalise the PDF automatically, so you don't need to worry about the normalisation constant.
Y. Hu

hi Hu,
just a question about your code:
the analytical expression for probability density distribution(PDF)of gaussian distribution is:exp(-(x - m).^2 ./ (2*sigma^2)) ./ (sigma*sqrt(2*pi))where m is the average and sigma is the standard deviation.
but you didn't use this formula? can you explain me why?
thank you

Hi ben,
Sorry that I can't reply soon enough. This issue might be due to the fact that your pdf spread quite narrow, and the code detect the probability to produce points beyond that region is lower than 1e-4, this is to make the code more efficient, however, you can modify line 68 and 73, to set this threshold smaller (however, the method I chose can't handle values smaller than eps.)
Y. Hu

Hi Hu,
i need to generate a sample of 1-D random numbers in [-10,10] which follows the PDF of Levy distribution. So i use your code. The problem that the resulting values are in the new range [-3.9394,3.9394] but i want that these values are in the original range including xmin=-10 and xmax=10.can you help me please?
thank you

Comment only

20 Feb 2014

Editing Matlab files in Vim
Edit Matlab M-files in Vim editor (indentation, syntax highlighting, tags , mlint support)

mlint in os x:
go to /usr/bin
run:
sudo ln -s /Applications/MATLAB_R2013b.app/bin/maci64/mlint mlint
Depending on your version of matlab chose different path in Applications.

Hi ben,
Sorry for the late reply. You're right about the expression for Gaussian distribution, however, you can easily generate a Gaussian PDF random number from the built-in random number generator, while my file is design specifically for PDFs that don't have a built-in generator. So I wrote an example of PDF in case that you don't know how to use the code and just execute it without any input arguments. One property of my code is that it can normalise the PDF automatically, so you don't need to worry about the normalisation constant.
Y. Hu

Comment only