0% found this document useful (0 votes)
100 views6 pages

Ee332 - Lab-Sheets - Student Workbook

1. The document describes an experiment using the Newton-Raphson method to find roots of equations. 2. The objectives are to determine roots using Newton-Raphson, understand the MATLAB implementation, and analyze results using different initial values and tolerances. 3. The algorithm uses successive approximations that converge quadratically to the root, where each iteration estimates the next root using the tangent line of the previous iteration.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views6 pages

Ee332 - Lab-Sheets - Student Workbook

1. The document describes an experiment using the Newton-Raphson method to find roots of equations. 2. The objectives are to determine roots using Newton-Raphson, understand the MATLAB implementation, and analyze results using different initial values and tolerances. 3. The algorithm uses successive approximations that converge quadratically to the root, where each iteration estimates the next root using the tangent line of the previous iteration.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

LAB EXPERIMENT # 2: ROOT FINDING USING NEWTON-RAPHSON

METHOD

Name:
Abdullah Khalid AL Howays Grade (20)

Registration Number:
1847830
BA
Lab Section:

Objectives
1. To determine roots of an equation in single variable using Newton-Raphson method.
2. To understand the MATLAB implementation of the Newton-Raphson method.
3. To analyze of results using different initial values and error tolerance.

Algorithm

Figure 2: Graphical description of the Newton-Raphson method.

Assuming the function f(x) is differentiable, a tangent of the function of 𝑥𝑖 , 𝑓 𝑥𝑖 , is


extrapolated down to the x-axis to provide an estimate of the root of 𝑥𝑖+1 as shown by Figure 2.
F F , N da a ca b a

𝑓 𝑥𝑖
𝑥𝑖+1 𝑥𝑖
𝑓 𝑥𝑖

EE332 – Numerical Methods in Engineering Student Workbook Page 9


From the above formula, an initial value is needed. The choice of the initial value will affect the
convergence of the solution.

Termination Criteria:

Defining the approximation error as


𝑥 −𝑥
𝜀𝑎,𝑖+1 % 100%
𝑥

where 𝑥𝑖+1 is the root of current (new) iteration and 𝑥𝑖 is the root of previous (old) iteration. The
notation 𝜀𝑎,𝑖+1 % represents the error for current estimate of the root (𝑥𝑖+1 ).

Then the computations will be terminated if

𝜀𝑎 % 𝜀𝑠 𝑜𝑟 𝑚𝑎𝑥𝑖𝑚𝑢𝑚 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑖𝑡𝑒𝑟𝑎𝑡𝑖𝑜𝑛𝑠 𝑖𝑠 𝑟𝑒𝑎𝑐ℎ𝑒𝑑

Pseudocode
FUNCTION NewtRaph(x0, es, imax)
i = 1
xi = x0
eai = ∞
DO
xi+1 = xi f(xi)/f (xi)
IF xi+1 ≠ 0 THEN
eai+1 = ABS((xi+1 xi)/xi+1)*100
END IF
DISPLAY i, xi, f(xi), f (xi), eai
IF eai < es OR iter imax EXIT
i = i + 1
END DO
NewtRaph = xi
END NewtRaph

EE332 – Numerical Methods in Engineering Student Workbook Page 10


Practical Work

Preliminary Work (to be done before lab session)

1. Consider the function 𝑓 𝑥 𝑥 3 2𝑥 2 6𝑥 4 0. Plot the graph of the function in


the interval [-3, 4].
2. Find the root of the function using the initial guess x0 = 3.0. Perform 4 iterations of the
Newton-Raphson method.
3. Understand the algorithm and the corresponding pseudo-code of the Newton-Raphson
method.

Lab Work

1. Write a MATLAB function y = func2(x) which implements the equation 𝑓 𝑥


𝑥 3 2𝑥 2 6𝑥 4 0. It will be used by the Newton-Raphson method.

function y func Z X

X 12 6 x 14
L x n
3 2

2. Write a MATLAB function y = dfunc2(x) which implements the derivative of the


equation 𝑓 𝑥 𝑥 3 2𝑥 2 6𝑥 4 0. It will be used by the Newton-Raphson
method.

function y dfunc Z X

Yi 3 X n
2 4 X 6

EE332 – Numerical Methods in Engineering Student Workbook Page 11


3. Implement the Newton-Raphson method in MATLAB using the given pseudocode.

initial guess

Xo 3 o i

tolerance
tolerance 2
Iterations
iteration o

the first entery


f print f f Md lo 6 f i lo sin
Iteration Xo funchXo dfunczXo

fromthe secondIterations
while I
liberation liberation 1 i

knew XO funor Xo dfundXo


ca too AbsCtxnew XDIXnew i

fPrintf C x15d l lo 6 f i lo Shi


Iteration Know fundCXnew dfunozMew
whenEu is less thantolerance
if eac tolerance
break
end
XO Xnew
end

EE332 – Numerical Methods in Engineering Student Workbook Page 12


4. Use the MATLAB implementation of Newton-Raphson method to find a root of the
function 𝑓 𝑥 𝑥 3 2𝑥 2 6𝑥 4 0 with the initial guess x0 = 3.0. Perform the
c
computations until percentage approximate relative error ( a (%) ) is less than s = 2% .
You are required to fill the following table.

Iteration 𝒙𝒊 𝒇 𝒙𝒊 𝒇′ 𝒙𝒊 ) 𝜺𝒂,𝒊 %
0 3 oooo 5 oooo 9.0000
1 3.5555 2.3319 17.7037 15.62
2 3 42380.1480 15.4725 3.85
3 3.41420 0007 15.3145 O 28

5. Repeat step 4 until percentage approximate relative error ( a (%) ) is less than s = 0.2% .

Iteration 𝒙𝒊 𝒇 𝒙𝒊 𝒇′ 𝒙𝒊 ) 𝜺𝒂,𝒊 %
0 3 oooo 5 oooo 9.0000
1 3.5555 2.3319 17.7037 15.62
2 3 42380.1480 15.4725 3.85
3
3.414260 0007 15.3145 O 28
4 3.41424 0.0000 15.3137 O 0002

6. Repeat step 4 using the initial guess x0 = -1.0.

𝒙𝒊 𝒇 𝒙𝒊 𝒇′ 𝒙𝒊 ) 𝜺𝒂,𝒊 %
Iteration
0 1 oooo 7 oooo 1 oooo
1 8 oooo 588.0000218 oooo 87.50
2 5.3027 169.5309 99.5685 50.87
3 3 oooo 46.9805 47.2824 47.2g
4 2.6064 11.6563 24.8071 38.12
5 2.1366 2.0642 16.2416 21.99
6 2.0095 0.1337 14.1523 6.32
7 2 oooo 0.00071 14.0008 0.47

EE332 – Numerical Methods in Engineering Student Workbook Page 13


Discussion and Analysis

1. How does the choice of the initial guess affect the solution?

in the newton Raphson method the initial genes


showd be as close as possible to the
Root or the might be divergence
insted of convergence which should happen

2. Discuss the convergence of the Newton-Raphson method.

convergence of the newton Raphson


Adullay the
method is powerful As the the method
extremely
to the root
the deference between
converges sornared Which
and the root
the approximation
means the number of accurate is doubled approx
many
in each Step
3. How the speed of convergence and the error tolerance ( s) are related?

the speed of the newton Raphson is pretty much


higher than the bisction method which means
it doesn't take much iterations

EE332 – Numerical Methods in Engineering Student Workbook Page 14

You might also like