Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Ramos, Romeo James B

BSEE 4-2

Laboratory Exercise #4

Newton-Raphson Method

Introduction:

The Newton-Raphson method (also known as Newton's method) is a way to quickly


find a good approximation for the root of a real-valued function f(x) = 0f(x)=0. It uses the idea
that a continuous and differentiable function can be approximated by a straight line tangent to it.
Just like fixed point iterations, newton-raphson are also an open method.
Suppose you need to find the root of a continuous, differentiable function f(x)f(x), and
you know the root you are looking for is near the point x = x_0x=x0. Then Newton's method tells
us that a better approximation for the root is

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:

1. To become familiar with the MATLAB application by creating source codes.

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

source code made in MATLAB application. 

Materials:

1. Laptop/Desktop or Personal Computer

2. MATLAB Application thru online or offline

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

online website to use MATLAB easily and readily. 


Ramos, Romeo James B
BSEE 4-2

 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

example for further clarification.    

 Then, another set of instruction again for the user to input the derivative of the function

also from the equation given by the user.   

 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

use the function input.

 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

run but it will not give the expected result. 

 I use the function “for” for the operation part of the program to operate the number of

iterations given by the user.

 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-

Raphson method for Xnew which is Xnew=Xold-(f(Xold)/f`(Xold)). 

 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

approaching the real value of the roots of the equation. 

 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

tolerance that the user put.  

Results and Discussion:

In order to fully understand fixed point iteration method here’s an example.

  for my example, it is equal to x2-x-1=0.  From our function, the derivative or the slope of

the function is equal to 2x-1. I will use 1 as my initial guess on the x.

  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

because if my initial guess on the x is diverging since this is an open-method, the

program will end with the display 'Newton Raphson Failed!’. 

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

for x will result into a converging equation

 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

original roots which are +1.618 and -0.618

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

for the root of a real-valued function.


Ramos, Romeo James B
BSEE 4-2

DCEE 25 – NUMERICAL METHODS AND ANALYSIS


First Semester A.Y. 2021-2022

Name: _Ramos, Romeo James B._      Student No.: _201812245_


Course / Yr. / Sec.: __BSEE 4-2__ Date: 10/08/2021

RUBRICS for LABORATORY REPORT

Laboratory Title: ________ Newton Raphson Method __________

CRITERIA Excellent Good Needs Improvement Un-acceptable Score


Submits the
Submits the
Laboratory Report Submits the
Submits the Laboratory
after the whole Laboratory Report
Punctuality Laboratory Report Report a week
class submits their after the day of the
(30 pts) exactly on the after the time of
report but within class but not more
right time. (30) the class and
the day of the than 4 days. (19-11)
onwards. (10)
class. (29-20)
Most of the
Some of the The explanation
The explanation explanation given
Interpretation explanation given was given was not
given was related was related to the
of the Results related to the topic of related to the
to the topic of the topic of the
(30) the experiment.  topic of the
experiment. (30) experiment. (29-
(19-16) experiment. (15)
20)
The data obtained The data obtained in
The data obtained in the experiment the experiment was The data
in the experiment was arranged on a arranged as a list with obtained in the
Presentation
is presented in a table but when no distinct experiment is no
of Data Obtain
way that it is close graph, it cannot be arrangement and way close to the
(20)
to the topic of the interpreted close when graph, it cannot topic of the
experiment. (20) to the topic. (19- be interpreted close to experiment. (15)
18) the topic. (17-16)

The report had plenty


Presentation The report had The report format
The report format of erasures, staple
of the Report erasures but the does not meet all
has met all the wires were not
Laboratory order was intact. the requirement.
requirement. (10) covered but the order
Format (10) (9-8) (5)
was intact. (7-6)
The report utilized The report mostly The report did
proper utilized not utilized
The report utilized
engineering tools engineering tools engineering tools
Engineering some engineering
such as such as such as
Drawing Tools tools such as
Engineering Engineering Engineering
(10) Engineering Lettering,
Lettering, Lettering, Lettering,
templates, etc. (7-6)
templates, etc. templates, etc. (9- templates, etc.
(10) 8) (5)

Final Score:
Ramos, Romeo James B
BSEE 4-2

You might also like