MD23D006 Golden Section Q3
MD23D006 Golden Section Q3
% First iteration
x1 = b - (b - a) / phi;
x2 = a + (b - a) / phi;
f1 = f(x1);
f2 = f(x2);
1
y = f(x);
figure;
plot(x, y);
hold on;
plot((a + b) / 2, f((a + b) / 2), 'ro', 'MarkerSize', 10); % Golden
section method minimum
plot(x_min_quad, f(x_min_quad), 'gx', 'MarkerSize', 10); % Quadratic fit
iteration minimum
xlabel('x');
ylabel('f(x)');
legend('f(x)', 'Golden Section Method Minimum', 'Quadratic Fit Iteration
Minimum');
title('Plot of the function');
grid on;