there are two formulas
K1 + K2 + K3 =1 (1)
K1 > K2 > K3 (2)
I need 100 random combinations of the K1, K2 and K3
how can I do in the MATLAB

9 件のコメント

KSSV
KSSV 2017 年 3 月 1 日
What is the range of K1,K2,K3? You must specify the limit and type of numbers.
Kaiser
Kaiser 2017 年 3 月 1 日
編集済み: Kaiser 2017 年 3 月 1 日
quotient
for example, K1=0.549 K2=0.351 k3= 0.1
KSSV
KSSV 2017 年 3 月 1 日
So you want Ki's between 0 and 1 ? They have to satisfy both the conditions?
Kaiser
Kaiser 2017 年 3 月 1 日
yes
0<Ki's<1
They must satisfy both the conditions!
KSSV
KSSV 2017 年 3 月 1 日
Modified my answer..
Kaiser
Kaiser 2017 年 3 月 1 日
編集済み: Kaiser 2017 年 3 月 1 日
haha because that is true.
You are right!
Do you know how to do in Matlab?
KSSV
KSSV 2017 年 3 月 1 日
I have answered it. Check the answer.
Kaiser
Kaiser 2017 年 3 月 1 日
Thank you very much!
KSSV
KSSV 2017 年 3 月 1 日
You have to accept the answer, if it is useful to you. That is thanking in mathworks.

サインインしてコメントする。

 採用された回答

KSSV
KSSV 2017 年 3 月 1 日
編集済み: KSSV 2017 年 3 月 1 日

1 投票

N = 100 ;
k = linspace(0,1,N) ;
[K1,K2,K3] = ndgrid(k,k,k) ;
thesum = K1+K2+K3 ;
idx = thesum==1 ;
K1 = K1(idx) ; K2 = K2(idx) ; K3 = K3(idx) ;
K = [K1 K2 K3] ;
idx = K1<K2 & K2<K3 ;
iwant = K(idx,:) ;

3 件のコメント

Kaiser
Kaiser 2017 年 3 月 1 日
編集済み: Kaiser 2017 年 3 月 1 日
Can you tell me what is the meaning of the"idx"?
If I want to declare K1 = 0.5? Can I only change the "K1=K1(idx)" to "K1=0.5" ?
KSSV
KSSV 2017 年 3 月 1 日
idx gives the indices of the elements in the array/ matrices satisfying given condition.
Kaiser
Kaiser 2017 年 3 月 1 日
編集済み: Kaiser 2017 年 3 月 1 日
Okay, I see~!
second~
If I want to declare K1 = 0.5? Can I only change the "K1=K1(idx)" to "K1=0.5" ?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeRandom Number Generation についてさらに検索

質問済み:

2017 年 3 月 1 日

編集済み:

2017 年 3 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by