- Save the probability distribution object from the "distributionFitter" app to the workspace. It usually saves a variable named "pd".
- Use the "truncate" function to create a new distribution object within the desired limits.
- Use the "random" function to generate numbers randomly using the distribution object.
How to randomly sample points within some range using a distribution fit obtained from distribution fitter app?
조회 수: 3 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2020년 10월 20일
편집: MathWorks Support Team
2025년 1월 31일
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.
채택된 답변
MathWorks Support Team
2025년 1월 25일
편집: MathWorks Support Team
2025년 1월 31일
As a workaround, please try the following steps:
>> pd_truncated = truncate(pd,45,60); >> number = random(pd_truncated)
For more details, you can refer to the documentation about the "truncate" function by executing the commands in the MATLAB R2020a command window:
>> web(fullfile(docroot, 'stats/prob.normaldistribution.truncate.html'))
For more details, you can refer to the documentation about the "random" function by executing the commands in the MATLAB R2020a command window:
>> web(fullfile(docroot, 'stats/prob.normaldistribution.random.html'))
Please follow the link below to search for the required information regarding the current release:
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!