Generate a random number with specific probability density function
조회 수: 7 (최근 30일)
이전 댓글 표시
I'm trying to generate a random number with a given PDF. I have the PDF stored as :
- X: with the possible values
- Y: with the density
plot(X,Y) displays the PDF
I've tried to use fitdist and makedist but I'm not able to convert it into a PDF object or anything usable.
Thanks you in advance
댓글 수: 0
답변 (1개)
Sean de Wolski
2015년 4월 7일
slicesample will do this for you.
댓글 수: 2
Torsten
2015년 4월 8일
Given x, interpolate the density y(x) from your data vector Y.
This will give you a Kind of "function" y(x).
Best wishes
Torsten.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!