# The Newton-Raphson Method For Root Finding Matlab 2020

The **Newton-Raphson Method** is one of the most extensively used methods for the original discovery. This can be easily generalized to the problem of finding a solution of a system of non-linear equations and linear equations known as Newton’s technique, that can be shown that the technique is quadratic as it approaches the origin.

**ACTUAL APPLICATION OF THE NEWTON-RAPHSON** METHOD:

In electrical power systems engineering we use the method to solve the problem of power flow (sometimes called load flow). This problem is considered by many other problems that are encountered in power system studies, such as polarity, such as: fault analysis, relay adjustment, protection, etc. There are hundreds of books and thousands of articles and conference papers about Newton-Raphson and his family.

**Derivation of Method:**

The * Newton-Raphson Method* is commonly used to improve the results obtained by any one of the previous ones. Let x0 be the approximate root of f (x) = 0, and let x1 = x0 + h be the correct root, so that f (x1) = 0. Expand f (x0 + h) by Taylor’s series, we get

f(X0) +hf’(X0) +h^2/2! f’’(X0) +………. = 0

Neglecting the second- and higher-order derivatives

f(X0) +hf’(X0) =0

h = -{f(X0)/ f’(X0)} [h is unknown]

A of higher quality approximate than x0 is therefore given by x1,

X1= X0-{f(X0)/ f’(X0)}

Consecutive approximations are given by X2, X3,…..,X(n+1),where

X(n+1) = Xn-{f(Xn)/ f’(Xn)}

Which is the Newton-Raphson formula. The Newton-Raphson is a second-order or quadratic transformation of the process.

The method replaces the segment of the curve through the tangent to the point curve between the point {X0, f (X0) point and the X-axis. And are illustrated illustratively. It can be used to solve both algebraic and transcendental equations, and can be used when the roots are complex.

Let’s solve a common problem for a clearer understanding:

**Example:**

Find a real root of the non-linear equation, Xe^x-1=0 by using Newton-Raphson Method.

Formula, h = -{f(X0)/ f’(X0)}

X1=X0+h [Here is X1 new value]

**Solve:**

Xe^x-1=0

or f(x)= Xe^x-1

or fd(x)= Xe^x+e^x

Let, f(x) = Xe^x-1

X0 = 1, f(x0) = 1.7182 [positive]

X1= 0, f(x1) = -1 [negative]

Iteration | X | f(X) | fd(X) | h | X1(new) |

1 | 0 | -1 | 1 | 1 | 1 |

2 | 1 | 1.7182 | 5.4365 | -0.3160 | 0.684 |

3 | 0.684 | 0.3555 | 3.3373 | -0.1065 | 0.5774 |

4 | 0.5774 | 0.0285 | 2.8099 | -0.0101 | 0.5673 |

5 | 0.5673 | 0.0004 | 2.7639 | -0.0014 | 0.5659 |

6 | 0.5659 | -0.0003 | 2.7576 | 0.0001 | 0.566 |

This example demonstrates that the NR method transforms faster than the method described in the previous section, since it requires less repetition to achieve certain accuracy. However, since two iterations are required for each iteration, the ** Newton-Raphson Method** requires more computing time.

## MATLAB PROGRAM:

Write a MATLAB program to solve the non-linear equation described in problem Xe^x-1=0 by using Newton-Raphson Method 7 iteration.

Code:

Output:

Here the values of x, f, fd, h and Xnew are shown: