Comparative Study of Different Root Location Methods Using MATLAB Program

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/285392960

Comparative Study of Different Root Location Methods Using MATLAB


Program

Article · December 2012

CITATION READS

1 961

1 author:

Muhibul Haque Bhuyan


Southeast University (Bangladesh)
127 PUBLICATIONS   301 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Modeling of Pocket Implanted MOSFETs View project

VLSI Circuit Design View project

All content following this page was uploaded by Muhibul Haque Bhuyan on 01 December 2015.

The user has requested enhancement of the downloaded file.


30 BHUYAN: COMPARATIVE STUDY OF DIFFERENT ROOT LOCATION METHODS USING MATLAB PROGRAMS

Green University Review


ISSN 2218-5283

Comparative Study of Different Root Location Methods Using


MATLAB Program

Muhibul Haque Bhuyan1

Keywords: Abstract: In this paper, different numerical methods for root location have been
Root Location studied by developing MATLAB programs. A mathematical problem from
electrical engineering field has been selected to find the root of a function. Roots
Methods,
are found for same data set so that different root location methods can be
No of Iterations, compared. Comparison is shown in terms of number of iterations required,
execution time needed, percentage of approximate errors and accuracy of the
MATLAB Program,
results. It has been observed that among these methods, Newton-Raphson
Percentage of method is faster and produces more accurate results. This type of problem
solving by using MATLAB programs from engineering discipline helps the
Approximate Error,
students to enhance their skills in both theory and practice in numerical analysis
Execution Time. of different problems of their respective fields.

exploit the fact that a function changes sign in


1. INTRODUCTION the vicinity of a root. These techniques are also
called bracketing methods, because in this case

I
N many cases, we need to find the roots of an
equation. Root location means searching for two initial guesses are required and these two
a value of an unknown variable of a function initial guesses brackets the true roots, i.e. these
so that the value of that function becomes zero guesses must be on either side of the root. The
for that particular value of that unknown variable particular methods employ different strategies to
[1]. There are several methods for the root systematically reduce the width of the bracket
location, but in case of transcendental equations and hence home in on the correct answer.
no general method exists for finding their roots
in terms of their coefficients [2]. In this case, The problem of finding roots of a given equation
numerical techniques are required. There are two is a very common problem in the field of
broad categories of numerical techniques to find engineering design [4-7]. In engineering design
the root of an equation, such as, open and close problems, at first, mathematical models or
methods. In the open method category, there are equations are derived to predict the dependent
several methods, such as, simple fixed point variables (that reflect the state or performance of
method, Newton Raphson method, secant the system) as a function of independent
method etc. In the close method category, there variables (along which the system behavior is
are several methods, such as, bisection method, being determined), forcing functions (that
regula-falsi method etc. [1,3]. Open method uses represent the external input signals) and
one or two initial guesses to find the approximate parameters (that represent its properties or
root of a function numerically. If two initial composition) [1-3].
guesses are used then both of them lie on one
side of the root. On the other hand, to find the Now a day, MATLAB programs are the vehicle
roots of an equation numerically close methods for presenting the underlying numerical

1
Muhibul Haque Bhuyan is with the Department of Electrical and Electronic Engineering, Green University of Bangladesh,
Dhaka, Bangladesh, E-mail: muhibulhb@gmail.com
Manuscript Dates: Received: 20 November 2012; Revised: 08 December 2012; Accepted: 15 December 2012
GREEN UNIVERSITY REVIEW, VOLUME 3, NUMBER 2, DECEMBER 2012 31

algorithms, and it is being used by practicing above function, a function file is written in
engineers in solving several numerical problems MATLAB. For the Newton-Raphson method, the
[8-11]. In this study, MATLAB programs have first derivative of the function file is also
been developed for the solution of a particular required. This file is used by the main files of
electrical circuit problem that cannot be solved each method to search the approximate value of
analytically. It has been shown that among all of R. The initial guesses are 200  and 400 .
these methods used to get the roots of this
particular problem, Newton-Raphson method is 3. ALGORITHMS OF DIFFERENT ROOT
faster and produces results that are more LOCATION METHODS
accurate. In this comparative study of root location four
2. PROBLEM SETTING different root location methods are considered,
such as, bisection, regula-falsi, Newton-Raphson
The pocket implanted n-MOSFET with split and secant methods. For this purpose, the
drain structure, shown in Fig. 1, is considered in
algorithms of these four methods are studied.
this work and assumed co-ordinate system is
Then MATLAB program is developed with
shown at the left side of the structure. The circuit
flowcharts of main program and function file
given in Fig. 1 is considered for this study. In
this circuit, at first, the capacitor (C) is charged using these algorithms.
from the DC voltage source (VDC) by throwing
the switch in position „A‟. 3.1 BISECTION METHOD
In general, if a function, f(x) is real and
continuous in the interval from xl to xu and f(xl)
and f(xu) have opposite signs, that is, if
f ( xl ) f ( xu )  0 then there is at least one real
root between xl and xu.

Incremental search methods capitalize on this


observation by locating an interval where the
Fig. 1 An RLC series circuit function changes its sign. Then the location of
sign change is identified more precisely by
When the capacitor is charged up to the amount dividing the interval into a number of
of q0 then the switch is thrown to position „B‟ subintervals. Each of these subintervals is
and the capacitor is allowed to discharge through searched to locate the sign change. The process
the RLC series circuit formed by the capacitor is repeated and the root estimate is refined by
(C), inductor (L) and resistor (R). If the capacitor dividing the subintervals into finer increments.
discharges to the amount of q at a certain time t,
then the equation of q can be written as given in The Bisection method is one type of incremental
equation (1). search method in which the interval is always

Rt  1  R 2  divided in half. If a function changes sign over
q  q0 e 2 L cos    t (1) an interval, the function value at the midpoint is
 LC  2 L  
  evaluated. The location of the root is then
determined as lying at the midpoint of the
Now, if we want to find out the value of subinterval within which the sign change occurs.
resistance (R) required for this RLC series circuit The process is repeated to obtain refined
for which charge (q) becomes 1% of original estimates. A simple algorithm for the bisection
value (q0) at a time t = 0.05 sec for given values method is given below:
of inductance (L) and capacitance (C) then we
can rearrange the equation (1) into a univariable 1. Choose lower and upper limit of initial
guesses, xl and xu respectively such that the
function of R as follows [1, 12]:
function changes its sign over the interval.

Rt  1  R 2  q This can be checked by ensuring that
f  R   e 2 L cos    t  (2)
 LC  2 L   q0 f ( xl ) f ( xu )  0 .
 
2. An estimate of the root is determined by
x  xu
The value of inductance and capacitance used xr  l
here are 5 H and 100 F respectively. For the 2
32 BHUYAN: COMPARATIVE STUDY OF DIFFERENT ROOT LOCATION METHODS USING MATLAB PROGRAMS

3. Determine in which subinterval the root lies: If  a   s , specified error tolerance, then stop
a. If f ( xl ) f ( xr )  0 , the root lies in the the iteration; otherwise go to step 2. The process
lower subinterval. Therefore, set xu = xr is repeated until this condition is met.
and return to step 2.
b. If f ( xl ) f ( xr )  0 , the root lies in the 3.3 NEWTON-RAPHSON METHOD
upper subinterval. Therefore, set xl = xr
Newton-Raphson method is the most widely used
and return to step 2.
of all root-locating formulas. If the function, f(x)
c. If f ( xl ) f ( xr )  0 , the root equals true
and an initial guess, xi is known then we can
root, i.e., xt = xr; terminate the easily draw a tangent at the point [xi , f(xi )]. The
computation. point where the tangent crosses the x-axis
usually represents an improved estimate of the
Evaluate the percentage of approximate errors by root. The formula is derived geometrically from
using the following formula: the straight line equation as the first derivative of
x new  x old the function f   x  represents the slope of the
 a  r new r 100%
xr tangent at that particular point. A simple
If  a   s , specified error tolerance, then stop algorithm for the Newton-Raphson method is
given below:
the iteration; otherwise go to step 2. The process
is repeated until this condition is met.
1. Choose an initial guess that will be close to
the true root.
3.2 REGULA-FALSI METHOD 2. An estimate of the root is determined by
In Regula-Falsi method or method of False- f  xi 
xi 1  xi 
Position, two points found from xl to xu are f   xi 
joined by a straight line. The intersection of this
3. Evaluate the percentage of approximate
line with the x-axis represents an improved
errors by using the following formula:
estimate of the root. It is also called linear
x x
interpolation method. The process is repeated to  a  i 1 i 100%
obtain refined estimates. A simple algorithm for xi 1
the Regula-Falsi method is given below: If  a   s , specified error tolerance, then stop
the iteration; otherwise go to step 2. The process
1. Choose lower and upper limit of initial
is repeated until this condition is met.
guesses, xl and xu respectively such that the
function changes its sign over the interval.
This can be checked by ensuring that
3.4 SECANT METHOD
f ( xl ) f ( xu )  0 . This method is almost the same as Newton-
2. An estimate of the root is determined by Raphson method where first derivative of the
f  xu  xl  xu  function is required. To simplify this two initial
xr  xu  guesses are needed. But it is not necessary that
f  xl   f  xu 
both should be located on the opposite side of the
3. Determine in which subinterval the root lies: root. The approximate first derivative has to be
a. If f ( xl ) f ( xr )  0 , the root lies in the found from these initial guesses and if this is put
lower subinterval. Therefore, set xu = xr in the formula of Newton-Raphson method then
and return to step 2. the formula of secant method is found. If two
b. If f ( xl ) f ( xr )  0 , the root lies in the initial guesses are x-1 and x0 then the formula for
upper subinterval. Therefore, set xl = xr approximate first derivative can be written as
f  xi   f  xi 1 
and return to step 2. f   xi   .
c. If f ( xl ) f ( xr )  0 , the root equals true xi  xi 1
root, i.e., xt = xr; terminate the
computation. A simple algorithm for the secant method is
given below:
Evaluate the percentage of approximate errors by
using the following formula: 1. Choose initial guesses that will be close to
x new  x old the true root.
 a  r new r 100%
xr
GREEN UNIVERSITY REVIEW, VOLUME 3, NUMBER 2, DECEMBER 2012 33

2. An estimate of the root is determined by method converges or iteration is stopped. Finally,


f  xi  xi  xi 1  the result is displayed at the command prompt of
xi 1  xi 
f  xi   f  xi 1  the MATLAB.
3. Evaluate the percentage of approximate START
errors by using the following formula:
x x Variable Initialization
 a  i 1 i 100%
xi 1
If  a   s , specified error tolerance, then stop
Function Call
the iteration; otherwise go to step 2. The process
is repeated until this condition is met. Root calculation

4. PROGRAM DEVELOPMENT IN Function Call


MATLAB i=1+1

Condition check and initial guess change


The function file is written using a MATLAB
command, 'function' followed by the variable Percentage of approximate error (a)
where calculated function value is saved and calculation
returned to the main file. Then function name is
inserted by which the main file calls the function N
a< s
file and the argument of the function is given in
Y
parenthesis through which the main file sends
Display of results
the value of the function‟s unknown variable.
Afterwards, this file initializes all the parameters END
required for calculation of the function value by
the obtained value of the argument variable from Fig. 3 Flow chart of the main program developed
the main file. The function is written by using for coding in MATLAB
various MATLAB commands as shown in Fig 2.
Same function is used for all the four root 5. SIMULATION RESULTS
location methods. The main file of Fig. 3 calls
this function file each time for calculation of the A comparison of various root location methods
function values. In MATLAB, function file discussed in previous section is given in Fig. 3
should be named by the function name. for the same function given in (2) after
MATLAB simulation of the codes for all of these
methods. For this purpose, an IBM machine with
Function Declaration
240 GB hard disk drive, 2 GB RAM and an Intel
Core2 Duo CPU with 2.8 GHz clock frequency is
Function’s variables initialization used. Microsoft Windows XP is used as the
operating system, and MATLAB program runs
under this operating system. Built-in timers of
Function value Calculation MATLAB have been used to calculate the
execution time of each program.
Fig. 2 Flow chart of the „function‟ file developed
in MATLAB for the function value calculation 1.0E+02
Bisection Method
using the various root location methods Regula-Falsi Method
Newton-Raphson Method
1.0E+01 Secant Method
Percentage of Approximate Errors

In the main file, at first initial guesses and other


1.0E+00
parameter values are declared. Then the main
file enters into a loop where algorithm of each 1.0E-01

method is written according to the formula given


1.0E-02
in the earlier section. As shown in the flow chart
of Fig. 3, root is calculated according to the 1.0E-03

algorithm of a particular root location method


and then the value of initial guess(es) is(are) 1.0E-04
0 2 4 6 8 10 12 14 16 18 20
changed according to the condition(s) set for that Number of Iterations Required

particular method. After that the condition to Fig. 4 Comparison of different numerical methods for
stop the iteration is tested and based on that the root location in terms of number of iterations required
34 BHUYAN: COMPARATIVE STUDY OF DIFFERENT ROOT LOCATION METHODS USING MATLAB PROGRAMS

Table 1 Execution time, number of iterations required, final roots and percentage of approximate error of
different root location methods
Name of the Execution No of Percentage of
Sl # Final root
Methods Time (sec) iterations Approximate Error (%)
1 Bisection 0.230586 19 328.1515121459961 5.812402410-5
2 Regula-Falsi 0.079270 8 328.1515112509088 8.986794210-5
3 Newton Raphson 0.068728 4 328.1514290851482 4.036895810-9
4 Secant 0.024693 4 328.1514290535596 8.088604610-5
Applications,” 4th Edition, ch. 1-5, Tata McGraw Hill
Publishing Co. Ltd., India, 2002.
Fig. 4 shows the percentage of approximate [2] J. B. Scarborough, “Numerical Mathematical Analysis,”
errors versus the number of iterations required. 6th Edition, ch. 10, Oxford and IBH Publishing Co. Pvt.
Here it is seen that for all the methods, Ltd., India, 1966.
[3] E. Lsaacson and H. B. Keller, "Analysis of Numerical
percentage of approximate errors decrease with Methods," 2nd Edition, Ch. 3, John Wiley and Sons, NY,
the increasing number of iterations. That means USA, 1994.
all the methods converges for the given problem. [4] M. A. Hasan, editor. Root Iterations and the
Computation of Minimum and Maximum Zeros of
But it is observed that bisection method takes a Polynomials, Proceedings of IEEE International
large number of iterations than that of the other Symposium on Circuits and Systems, 2005.
three methods and Newton-Raphson method [5] J. Rothweiler. A rootfinding algorithm for line spectral
takes less number of iterations for the same frequencies. In the proceedings of IEEE International,
Conference on Acoustics, Speeches and Signal
specified error limit. Convergence rate is faster Processing, 2:661:664, 1992.
in Newton Raphson method than the other three [6] J. Jr. Campbell, V. Welch, and T. Tremain. An
methods, since from Fig. 4 it is seen that the expandable error-protected 4800 bps CELP coder (u.s.
federal standard 4800 bps voice coder). In IEEE Int.
slope of the curve is higher than that of the other Conf. on Acoustics, Speech and Signal Processing, page
three. It is also observed that Newton-Raphson 735:738, 1989.
method produces more accurate results than the [7] J. Hubbard, D. Schleicher, and S. Sutherland. How to
find all roots of complex polynomials by newton‟s
other three methods for the same specified error method. Inventiones Math., 146:1:33, 2001.
limit. On the other hand, secant method takes [8] J. H. Mathews and K. D. Fink, “Numerical Methods
less execution time than the other three methods. using MATLAB,” 4th Edition, ch. 2, Prentice-Hall of
India, 2004.
This is because, it does not need to evaluate two [9] J. Butt, “Introduction to Numerical Analysis Using
different functions as Newton-Raphson method MATLAB,” ch. 1, Jones & Bartlett Learning, 2009.
does. However, the result produced by secant [10] C. Moler, “Numerical Computing with MATLAB,”
http://www.mathworks.com/moler/chapters.html,
method is not as good as Newton-Raphson retrieved December 2012.
method. Of course, execution time may vary [11] J. Kiusalaas, “Numerical Methods In Engineering With
from machine to machine. Besides, among the MATLAB,” Cambridge University Press, 2005.
[12] V. Y. Pan, “Univariate polynomials: Nearly optimal
four methods, Newton-Raphson method produces algorithms for factorization and root finding,” In B.
least amount of percentage of approximate error Mourrain, editor, Int. Symp. Symbolic and Algebraic
at the final iteration. It is shown in the Table 1. Computation, page 253:267, London, Canada, 2001.

6. CONCLUSIONS
A comparative study of various root location Muhibul Haque Bhuyan (M'07)
methods have been performed using MATLAB born in Dhaka, Bangladesh in
programs. In this study, a particular root 1974. He received the B.Sc. Engg.,
searching problem from the branch of electrical M.Sc. Engg. and Ph.D. degrees all
in Electrical and Electronic
engineering has been taken and solved for the Engineering (EEE) from
same parameter values and initial guesses by all Bangladesh University of
the methods mentioned. Comparison shows that Engineering Technology (BUET), Dhaka, Bangladesh
for this problem Newton Raphson method is in 1998, 2002 and 2011 respectively.
better, but this comparison can be applied to At present, Dr. Bhuyan is working as an Associate
problems of any other branches of engineering as Professor and Chairman in the Department of
well as other disciplines. This will certainly Electrical and Electronic Engineering (EEE) of Green
increase the numerical computational skills of University of Bangladesh (GUB) since July 2012. He
the students studying in undergraduate level. started his career as a Faculty Member in the
Department of ECE/EEE of American International
REFERENCES University Bangladesh (AIUB) and worked there from
June 1999 to June 2003. Then he was with the Ultra-
[1] S. C. Chapra and R. P. Canale, “Numerical Methods for
Engineers with Software and Programming
Scaled Devices Engineering Laboratory under the
Center of Excellence (COE) program of Hiroshima
GREEN UNIVERSITY REVIEW, VOLUME 3, NUMBER 2, DECEMBER 2012 35

University, Japan as a Researcher from July 2003 to His research interest includes modeling of the pocket
March 2004. From July 2005 to August 2008, Dr. implanted bulk, double-gate and SOI n-MOSFET,
Bhuyan led the Department of Electronics and power electronics and control systems design using
Telecommunication Engineering (ETE) of Daffodil PLC, microcontroller, DSP, FPGA etc. He is involved
International University (DIU) as the Head of the in numerical computations of electrical and electronic
Department and played a pioneering role in engineering problems using MATLAB. He also works
establishing the Department of ETE and in opening a on the development and improvement of electrical and
new Department of Electrical and Electronic electronic engineering education in the university
Engineering (EEE) in DIU. He worked as an Assistant sector in Bangladesh. He has over 50 national and
Professor in DIU from July 2005 to May 2010 and in international journal and conference papers.
Presidency University (PU) from June 2010 to Dr. Bhuyan is the Executive Editor of the Green
December 2011 and as an Associate Professor of the University Review and the Executive Member of
Department of EEE in DIU from January 2012 to June Bangladesh Electronics Society (BES); Life Member
2012. He also worked as a Part-time Lecturer in the of Institute of Engineers Bangladesh (IEB) and
Department of EEE of Ahsanullah University of Member of IEEE and EDS. He was the Secretary of
Science and Technology, Bangladesh and as an IEEE Bangladesh Section and Editorial Board‟s
Adjunct Assistant Professor in the Department of Member Secretary of the Daffodil International
CSE/ETE/EEE of East West University (EWU), University Journal of Science and Technology. He is
Peoples University of Bangladesh (PUB) and DIU. also serving as the Editor and Reviewer of many other
national and international journals.

View publication stats

You might also like