MATLAB: How to randomly sample points within some range using a distribution fit obtained from distribution fitter app

distributionfitterMATLABpdfpointsrandomsampletruncate

I am used distribution fitter app to fit a probability distribution on my data, and I am able to save distribution object to workspace.
Now I want to use newly fitted distribution to generate random numbers within a desired range. 
Please help me in achieving this workflow.

Best Answer

As a workaround, please try following steps:
  • Save probability distribution object from "distributionFitter "app to workspace. It usually saves a variable named "pd"
  • Use "truncate" function to create a new distribution object within desired limits. 
  • Use "random" function to generate numbers randomly using the distribution object. 
>> pd_truncated = truncate(pd,45,60);
>> number = random(pd_truncated)
For more details please refer following documents: