フィルターのクリア

minimum of all iterations

2 ビュー (過去 30 日間)
summyia qamar
summyia qamar 2016 年 12 月 15 日
編集済み: David Barry 2016 年 12 月 15 日
A=[1 0 0 1 0 1 1
0 1 1 1 0 0 1
1 0 0 1 1 0 0
1 0 0 0 1 0 1
1 1 0 0 0 1 0
0 1 0 0 0 1 1];
demand=[600;550;620;500;590;600]
for k=1:100
B=randi([0,1],7,3)
C=A*B
C(C>=1)=1
D=sum(C,2)
D1=sum(bsxfun(@times,D,demand))
end
I want to get the minimum value of D1 from all iterations

採用された回答

David Barry
David Barry 2016 年 12 月 15 日
編集済み: David Barry 2016 年 12 月 15 日
A=[1 0 0 1 0 1 1
0 1 1 1 0 0 1
1 0 0 1 1 0 0
1 0 0 0 1 0 1
1 1 0 0 0 1 0
0 1 0 0 0 1 1];
demand=[600;550;620;500;590;600];
numIterations = 100;
D1 = zeros(numIterations, 1);
for k=1:numIterations
B=randi([0,1],7,3);
C=A*B;
C(C>=1)=1;
D=sum(C,2);
D1(k)=sum(bsxfun(@times,D,demand));
end
minVal = min(D1);

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 12 月 15 日
D1(k)=sum(bsxfun(@times,D,demand));
and after the loop, min(D1)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by