필터 지우기
필터 지우기

For loops on a space

조회 수: 2 (최근 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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by