You are on page 1of 20

GOLDEN SECTION SEARCH METHOD

AND ALGORITHM USING MATLAB


- H A S H M I VA R D H A N K U N D R A P U
INTRODUCTION:
• The golden section search is a technique for finding the extremum
(minimum and maximum) of a function by successively narrowing the
range of values inside which the extremum is known to exist.
• The taken function, for which the method is applied, should be
unimodal in the given range.
• The algorithm uses the importance of Golden Ratio,
.
GENERAL PROCEDURE & ALGORITHM:

• Initially, let the domain of the function be .


ITERATION – 1:
• Choose an initial guess ; where
;
k is the iteration number & .
• After finding and , find . If
⇒ is increasing from and the minima
• Else: is decreasing after and the minima
ITERATION – 2:
• Estimate by taking the reduced interval from iteration-1 as main interval in
iteration-2.
• In first iteration, we assumed 2 equations. But to optimize
computations, we assume and only find
• Now defining at distance from , by distance calculations, we get,

• Here, is constant. So,

ÞOn solving gives,.


• As which is equal to .
• Hence it’s called as Golden Section Search.
EXAMPLE CODE:

• golden_section.m :

figure; hold on;


a0 = 0;
b0 = 2;
epsilon=0.000001;
tot_iter= 20;
rho=double((3-sqrt(5))/2);
i=0;
a1 = a0+rho*(b0-a0);
b1 = b0-rho*(b0-a0);
f_a1=function_example(a1);
f_b1=function_example(b1);
plot(a1,f_a1,'r*')
plot(b1,f_b1,'r*')
while ((abs(b0-a0)>epsilon) && (i<tot_iter))
if (f_a1<f_b1)
b0=b1;
b1=a1;
a1 = a0+rho*(b0-a0);
f_a1=function_example(a1);
f_b1=function_example(b1);
plot(a1,f_a1,'r*');
else
a0=a1;
a1=b1;
b1 = b0-rho*(b0-a0);
f_a1=function_example(a1);
f_b1=function_example(b1);
plot(b1,f_b1,'r*')
end
i=i+1;
end
% choosing minimum point
if (f_a1<f_b1)
sprintf('x_min=%f', a1)
sprintf('f(x_min)=%f ', f_a1)
plot(a1,f_a1)
else
sprintf('x_min=%f', b1)
sprintf('f(x_min)=%f ', f_b1)
plot(b1,f_b1)
• function_example.m :

function y=function_example(x)
y=x^2-2*x+1;

OUTPUT & RESULTS:


APPLICATIONS:
Golden section search can be used to find roots of the polynomials, and
also to minimize the interval of a function for the optimal value.
• Application of the golden section search algorithm in the nonlinear
iso-conversional calculations to the determination of the activation
energy from non-isothermal kinetic conversion data.
• Application of the golden section search algorithm to tune the circuits.
• Application of the golden section search algorithm for finding the Q-
factor for any RLC circuits.
APPLICATION: Q-FACTOR OF AN RLC CIRCUIT CONNECTED IN SERIES

• The Q-factor is a fundamental parameter that characterizes the behavior of RLC


circuits. It is a dimensionless quantity that can range from very low values to very
high values, depending on the values of the circuit components.
• In practical applications, the Q-factor is important because it determines the quality
of the circuit's performance.
• For example, in radio and television broadcasting, it is important to have high-Q
circuits to prevent interference with neighboring channels.
• In electronic filters, a high-Q circuit can provide a sharp cutoff and minimize the
amount of unwanted frequencies that pass through the filter.
• A higher Q-factor indicates that the circuit is more selective in passing a narrow
range of frequencies around the resonant frequency, and that the circuit can store
energy for a longer period of time before it dissipates.
• Conversely, a lower Q-factor indicates that the circuit is less selective and
dissipates energy more quickly.
• The Q-factor of an RLC circuit connected in series is defined as the ratio of
the energy stored in the circuit to the energy dissipated per cycle.
Mathematically, it is given by:

• Where is the resonant frequency of the circuit, L is the inductance, and R is


the resistance.

Þ Q-factor, .
• The golden section search algorithm is then used to find the resonant frequency
w0 that makes the Q-factor value unity.
• The algorithm uses the function handle to evaluate the function at two points x1
and x2, and iteratively narrows down the search range until the difference
• Lets consider the capacitance value, . Now, we have to calculate the values of
resistance and inductance to calculate the Q-factor.
• Our required Q-factor be unity and we have to verify the values of in the range
and L in the range .
• So we’ll take all the values of resistances in that range (integral values) and apply
golden section search for the optimal inductance for the range of inductances, and
calculate the Q-factor.
• We’ll solve 2-3 iterations manually.
Initially,
for ,
Iteration 1:
;
Now consider points
;
;

⇒The optimized value lies in between


• Again consider another set of points, with same ratio in this interval and
calculate the Q-factor.
• Repeat this process until the interval reduces less than a particular
tolerance value.
• Then increment as , and again repeat the process, until we achieve the
desired Q-factor or the tolerance level and the iteration level is fulfilled.
CODE:
clc
C = 1e-9; % Capacitance in farads
Q_factor_desired = 1 ;
% Define the range of values for the resistance & inductance
R_min = 500; % Minimum resistance value in ohms
R_max = 1500; % Maximum resistance value in ohms
L_min = 5e-4; % Minimum inductance value in Henry
L_max = 15e-4; % Maximum inductance value in Henry

f = @(x,y) (sqrt(y)./(x.*sqrt(C))); %x=R, y = L,


% Define the golden ratio and the initial points for the search
rho = double((3-sqrt(5)) / 2);
c = L_min;
d = L_max;
maxiter = 1000;
i =1;
Q_factor=0;
eeta = 1e-5;
opt_Q_factor = 0;
opt_R = 0;
opt_L = 0;
% Loop until the desired tolerance is reached
for j = R_min:R_max
while(i<=maxiter && abs(c-d)>eeta)
% Calculate the two points to evaluate the function at
d1 = d - rho * (d-c);
c1 = c + rho * (d-c);
% Choose the new search interval based on the function values
if f(j,d1) > f(j,c1)
d = d1;
R_optimal = j;
L_optimal = d;
d1=c1;
c1 = c + rho*(d-c);
else
c = c1;
R_optimal = j;
L_optimal = c;
c1=d1;
d1 = d - rho * (d-c);
end
if (Q_factor>1) && (Q_factor<1.002)
opt_Q_factor = Q_factor;
opt_R = R_optimal;
opt_L = L_optimal;
end
i=i+1;
end
c = L_min;
d = L_max;
i=1;
Q_factor = f(R_optimal,L_optimal);
% Display the results for each iteration
fprintf('Optimal resistance value: %g ohms\n', R_optimal);
fprintf('Optimal inductance value: %g ohms\n', L_optimal);
fprintf('Q-factor achieved: %g \n', Q_factor);
end
% Final result
fprintf('\nOptimised resistance value: %g ohms\n', opt_R);
fprintf('Optimised inductance value: %g ohms\n', opt_L);
% Plot the 3D graph
R1 = linspace(R_min,R_max,1000);
L1 = linspace(L_min,L_max,1000);
[x,y] = meshgrid(R1,L1);
z = f(x,y);
k = colormap(jet(length(R1)/10));
surf(x,y,z, 'FaceColor','interp','EdgeColor','none');
colormap(k);
colorbar;
xlabel('ohms')
ylabel('Henry')
zlabel('Q-factor')
title('Q-factor of an RLC circuit connected in series')
hold on;
% Mark the optimized point
scatter3(opt_R, opt_L, opt_Q_factor, 'red', 'x','LineWidth',1);
RESULT:
GRAPH-PLOT:
REFERNCES:
• Y. -C. Chang, "N-Dimension Golden Section Search: Its Variants and Limitations," 2009 2nd
International Conference on Biomedical Engineering and Informatics, Tianjin, China, 2009,
pp. 1-6, doi: 10.1109/BMEI.2009.5304779.

• R. P. Kristianto and A. Setyanto, "Golden Section Search-Multi Variable Algorithm for


Optimization Parameter of Triple Exponential Smoothing Algorithm to Predict Sufferers of
Lungs Disease," 2018 3rd International Conference on Information Technology, Information
System and Electrical Engineering (ICITISEE), Yogyakarta, Indonesia, 2018, pp. 194-198,
doi: 10.1109/ICITISEE.2018.8720967.

• M. Capek, L. Jelinek and P. Hazdra, "On the Functional Relation Between Quality Factor and
Fractional Bandwidth," in IEEE Transactions on Antennas and Propagation, vol. 63, no. 6, pp.
2787-2790, June 2015, doi: 10.1109/TAP.2015.2414472.
• https://www.sciencedirect.com/science/article/abs/pii/S1293255810000622
THANK YOU

You might also like