Generate random numbers with a constraint
조회 수: 4 (최근 30일)
이전 댓글 표시
I want to generate several numbers that meet a constraint. The constraint may be kind of complex, nonlinearity for example.
It occurs to me that there are also constraint input in the optimization toolbox. In some intelligent algorithm like ga, i guess the toolbox can generate input parameters according to the constraint. I want to know how it works and implement this function in my own script.
댓글 수: 3
채택된 답변
Jiri Hajek
2022년 10월 11일
A general answer to your general question is inverse transform sampling, which makes it possible to generate sample random data from any probability distribution.
댓글 수: 6
Jiri Hajek
2022년 10월 11일
편집: Jiri Hajek
2022년 10월 11일
Well, it seems that if you still have some concerns, than your problem statement was probably not complete... There's really no problem to e.g. generate random numbers that are integer and positive or e.g. random numbers constrained by a nonlinear inequality (like coodrinates from an area constrained by some curve). Here I agree with Rik that you can get an answer only to a properly defined question.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Random Number Generation에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!