[25]
The figure below shows an algorithm which uses Golden-Section Search to find the value of xopt with a relative error es in the interval a,b at which the function f(x) has a maximum value fx.
a) Convert this algorithm into a Matlab function program GSS(f,a,b,es) which returns the value of xopt and fx to the calling program.
b) Write a Matlab script which calls the function program developed in part (a) to find the value of xopt to an accuracy of 5 significant figures in the interval 0,2 at which the function g(x)=1 x(2-x) has a maximum value gx and prints the value of xopt and gx.