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 Center および File ExchangeRandom Number Generation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by