generate random number with nonlinear constraints

조회 수: 2 (최근 30일)
alex brown
alex brown 2019년 4월 7일
I want to generate 5 uniformly distributed random numbers whose upper and lower bounds will be upb=[4 2 -2.5 .9 -.1]; and lowb=[0 1 -4 -1 -.2]; respectively. These numbers should also satisfy 2 linear constraints and 2 nonlinear constraints. The linear constraints are: 1st lin const) sum of the 1st, 3rd, and 4th numbers have to be greater or equal to sum of the 2nd and 5th numbers. In other words sum(n1,n3,n4)>=sum(n2,n5). 2nd lin const) sum of the numbers should equal to 1. In other words sum(n1:n5)==1; And the nonlinear constraints are: 1st nonlin const) 0 <= (sin(n1) + cos(n2)) <= 0.2 2nd nonlin const) 7 < (n3^2 - n4) < 9
I know that, rand(1,5).*(upb-lowb)+lowb; will generate random numbers but I don't know how to use constraints.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Random Number Generation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by