Minimize f(alpha) = (40 - 90 times alpha)^2 over the interval alpha_1 = 0 and al
ID: 3108693 • Letter: M
Question
Minimize f(alpha) = (40 - 90 times alpha)^2 over the interval alpha_1 = 0 and alpha_u = l. Apply the golden section search method. Use epsilon = 0.1. Identify the optimum point by hand. Also, develop your own Matlab codes for the golden section search method to verify the obtained answer from (a). Solve the following problem by using the developed Matlab codes from (b). The objective function is f(alpha) = 8 times alpha^2 - 8 times alpha + 2. In this case, the initial interval is not given. Thus, you will need to conduct the initial bracketing for the problem (c) first.Explanation / Answer
MATLAB Code for Parts (b) & (c):
%% Part (b)
a = 0; b = 1; eps = 0.1; tol = sqrt(eps);
gr = (sqrt(5) + 1) / 2; % Golden ratio
c = b - (b - a) / gr;
d = a + (b - a) / gr;
while(abs(c - d) > tol)
if(fb(c) < fb(d))
b = d;
else
a = c;
end
c = b - (b - a) / gr;
d = a + (b - a) / gr;
end
disp('Output (For Part (b)): ');
disp((b+a)/2);
%% Part (c)
a = -2; b = 4; % Change the initial interval to get
% slightly different minimum values
c = b - (b - a) / gr;
d = a + (b - a) / gr;
while(abs(c - d) > tol)
if(fc(c) < fc(d))
b = d;
else
a = c;
end
c = b - (b - a) / gr;
d = a + (b - a) / gr;
end
disp('Output (For Part (c)): ');
disp((b+a)/2);
File fb.m
function [y] = fb(x)
y = (40-90*x);
y = y*y;
end
File fc.m
function [y] = fc(x)
y = 8*x*x - 8*x + 2;
end