For loops on a space

1 回表示 (過去 30 日間)
Saeid Hajizadeh
Saeid Hajizadeh 2014 年 5 月 20 日
編集済み: Saeid Hajizadeh 2014 年 5 月 20 日
Dear Guys,
I want to compute the borders of a region. The region is like below:
R <= f1(p1,p2,p3,p4,p5,p6,p7,p8)
R <= f2(p1,p2,p3,p4,p5,p6,p7,p8)
over all p1, p2, p3, p4, p5, p6, p7, and p8 where p1+p2+p3+p4+p5+p6+p7+p8 = 1 (probability space)
So I have seven randoms in p1, p2 , p3, p4, p5, p6, and p7 (or seven degrees of freedom).
My problem is that I can not find a way to cover the whole space. To be brief,
I have given my code for the same problem with three degrees of freedom, where
R <= f1(p1,p2,p3,p4)
R <= f2(p1,p2,p3,p4)
over all p1, p2, p3, and p4 where p1+p2+p3+p4 = 1:
********
clear all
Rf = 0;
p1(1) = 0.00001;
p2(1) = 0.00001;
for j1 = 1:1:101
if j1 > 1
p1(j1) = 0.00001 + 0.004998*(j1-1);
p2(j1) = 0.00001 + 0.004998*(j1-1);
end
p3(j1) = 1 - p1(j1) - p2(j1);
end
for i1 = 1:1:101
for i2 = 1:1:101
for i3 = 1:1:101
R1(i1,i2,i3) = f1 (p1(i1),p2(i2),p3(i3)) ;
R2(i1,i2,i3) = f2 (p1(i1),p2(i2),p3(i3)) ;
R(i1,i2,i3) = min(R1(i1,i2,i3),R2(i1,i2,i3));
Rf = max(R(i1,i2,i3),Rf);
if R(i1,i2,i3) > Rf
a1 = i1;
a2 = i2;
a3 = i3;
end
end
end
end
***************

回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by