Professional Documents
Culture Documents
BU/17A/ENG/2538
Advance Computer Programming & Statistics (503)
Golden section search
figure();
r = 0;
plot ([a,b,c], [r,r,r], 'b-x');
hold on;
r = r + 0.25;
gold = (3 - sqrt(5)) /2;
% Do a golden search
while (abs(c - a) >= min_width)
%Plotting graph
fb = x^2 + exp(-abs(x-4));
ans =
-0.0132
Figure 1 Golden_section(@my_func2,1 , 1, 0.01)
%Equation 2
function fc = my_func3 (x) %my_function test function for
minimisation
ans =
2.8673
Figure 2Golden_section(@my_func3,1 , 1, 0.01)