generate random number with nonlinear constraints

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (0)

Categorie

Scopri di più su Random Number Generation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by