Professional Documents
Culture Documents
REG.NO : 18BCM0078
Initialization Step :
Select an allowable final length of uncertainty l > 0 Let the initial interval of
uncertainty be [a1,b1] and let λ1= a1 +(1- α)(b1 - a1) and μ1= a1 +α(b1 - a1) ,
where α = 0.618. Evaluate θ(λ1) and θ(μ1) , let k= 1 and go to Main Step.
Main Step :
1. If bk - ak < l , stop ;The optimal solution lies in the interval [ak,bk] . Otherwise , if θ(λk) > θ(μk) ,
go to Step 2 and If θ(λk) ≤ θ(μk) , go to Step 3 .
2. Let ak+1 = λk and bk+1 =bk . Furthermore , let λk+1 = μk and let μk+1= ak+1+α(bk+1-ak+1)
. Evaluate θ(μk+1) and go to Step 4.
3. Let ak+1 = ak and bk+1 = μk .Furthermore , let μk+1 = λ k and let λ k+1=
ak+1+(1-α)(bk+1-ak+1) . Evaluate θ(λ k+1) and go to Step 4.
Question:
MATLAB Code:
x = 1;
for c=0:01:5
f(x)=2*c/(4+0.8*c + c^2 +
0.2*c^3); cc(x)=c;
x=x+1; end
plot(cc,f)
xlabel('d')
ylabel('g')
fun=@(x)-
(2*x/(4+0.8*x+x^2+0.2*x^3)); x1 = 0;
x2 = 5;
options = optimset
('Display','iter'); [x,fval] =
fminbnd(fun,x1,x2)
Output:
x=
1.5679
fval =
-0.3696