Professional Documents
Culture Documents
Laboratory Exercise #4 Newton-Raphson Method
Laboratory Exercise #4 Newton-Raphson Method
BSEE 4-2
Laboratory Exercise #4
Newton-Raphson Method
Introduction:
This process may be repeated as many times as necessary to get the desired accuracy. In
general, for any xx-value xnxn, the next value is given by
Objectives:
2. To create a source code for Newton-Raphson method with the use of MATLAB application.
3. To perform Newton-Raphson method with sample equation and to find its roots using the
Materials:
Procedure:
Ramos, Romeo James B
BSEE 4-2
You can use MATLAB offline by installing it on your computer or you can just go to their
Creating a source code in MATLAB should result to a user-friendly and the instructions
should be clear at all times for the user of program to understand it quickly how it works.
I use the disp function in MATLAB to show what kind of program that is running which is
Newton-Raphson Method.
I use the disp function again to show how to put the function clearly and there is an
Then, another set of instruction again for the user to input the derivative of the function
Then, I assign letters and combination of letters for different values for me to create the
code for the operation easily and quickly. Those values will be from the user that’s why I
Just like doing Newton-Raphson Method manually, the initial guess will be dependent on
the user whether it will result to a converging or diverging equation. It will be also be
Ramos, Romeo James B
BSEE 4-2
dependent on the user the number of iterations and the tolerance so the roots will be
found.
This step will be the operations, conditions and the output part of the source code and
this is a hard part because if the code here is wrong the program would not run or it will
I use the function “for” for the operation part of the program to operate the number of
Newton-Raphson method is a simple method that you just need to find the slope of the
function or its derivative so that it will be easily substituted on the equation for Newton-
The initial guess will be put into that equation and then the output will be the new input
on the next iteration. As you are approaching the minimum percent error, you are also
As you can see from the operation above that the error is equals to the (Xnew -
Xold)/(Xnew), meaning that the lesser the error, the root is also approaching near the
original roots.
Ramos, Romeo James B
BSEE 4-2
Then, the operation will stop and finish if the percent error is less than the desired
for my example, it is equal to x2-x-1=0. From our function, the derivative or the slope of
I assigned the value of the tolerance as 0.00 to assure that the roots will be accurate
and precise. Then, for the number of iterations I put 5 and notice that it is converging
If X=1
Ramos, Romeo James B
BSEE 4-2
If X=-1
Ramos, Romeo James B
BSEE 4-2
Here is how I use the Newton-Raphson Method manually to find the roots of the equation. As
you can see, I use two different values for x which is x = 1 and x = -1. Using these two values
Since this is a quadratic function meaning there will be two applicable values of the roots
of the equation. By doing it manually I get +1.618 and -0.618 which same from the
Conclusion:
Creating a source code for the Newton-Raphson method will give you a wider knowledge of how
it really works, using MATLAB software we can saw here how convenient it is solving roots
using newton Raphson , not just in terms of speed but especially its accuracy. Since this is an
open method we just need to check if our solution is converging or diverging on the original
Ramos, Romeo James B
BSEE 4-2
roots of the equation. The equation is derived from the slope or the derivative of the equation
which is rise over run. Newton – Raphson method is a way to quickly find a good approximation
Final Score:
Ramos, Romeo James B
BSEE 4-2