Documente Academic
Documente Profesional
Documente Cultură
College of Engineering
Electronics Engineering Department
MACHINE PROBLEM #3
NEWTON RAPHSON METHOD
Submitted by:
Instructor:
ROMMEL PEDRAZA
BSEcE 5
(05):____
(20):____
Observation, Analysis
(30):____
Conclusion
(25):____
Tardiness
(10):____
Presentation, Neatness
(20):____
Total
(100):____
INTRODUCTION
Newton's method, also called the Newton-Raphson method, is a root-finding algorithm that
uses the first few terms of the Taylor series of a function f(x) in the vicinity of a suspected root.
Newton's method is sometimes also known as Newton's iteration, although in this work the latter term
is reserved to the application of Newton's method for computing square roots.
For f(x) a polynomial, Newton's method is essentially the same as Horner's method.
Equation (2) is the equation of the tangent line to the curve at (x_0,f(x_0)), so (x_1,0) is the place where
that tangent line intersects the x-axis. A graph can therefore give a good intuitive idea of why Newton's
method works at a well-chosen starting point and why it might diverge with a poorly-chosen starting
point.
This expression above can be used to estimate the amount of offset epsilon needed to land closer to the
root starting from an initial guess x_0. Setting f(x_0+epsilon)=0 and solving (2) for epsilon=epsilon_0
gives
which is the first-order adjustment to the root's position. By letting x_1=x_0+epsilon_0, calculating a
new epsilon_1, and so on, the process can be repeated until it converges to a fixed point (which is
precisely a root) using
Unfortunately, this procedure can be unstable near a horizontal asymptote or a local extremum.
However, with a good initial choice of the root's position, the algorithm can be applied iteratively to
obtain
for n=1, 2, 3, .... An initial point x_0 that provides safe convergence of Newton's method is called an
approximate zero.
OBJECTIVES
To find the root of the equation f(x) =
Method.
Write a MATLAB program to compute the given equation.
MATLAB CODES
clc
clear
disp('Roots for Numerator');
disp(' ');
disp('xi1 = 0');
disp(' ')
disp('xr1
fxr1
ea')
disp('_____________________________________________________________________________')
es=0.0000001;
n = @(s)(s^3 + 9*s^2 + 26*s + 24);
dn = @(s)(3*s^2 + 18*s + 26);
ea = 100;
xi1 = 0;
while ea > es;
xr1 = xi1 - n(xi1)/dn(xi1);
fxr1 = n(xr1);
ea = abs((xr1-xi1)/xr1);
fprintf('%e\t\t\t\t\t %e\t\t\t\t\t %e\n', xr1,fxr1,ea);
xi1 = xr1;
end
disp(' ')
disp('-----------------------------------------------------------------------------')
disp(' ')
disp('xi2 = -2.6')
disp(' ')
disp('xr2
fxr2
ea')
disp('_____________________________________________________________________________')
es=0.0000001;
n = @(s)(s^3 + 9*s^2 + 26*s + 24);
dn = @(s)(3*s^2 + 18*s + 26);
ea = 100;
xi2 = -2.6;
while ea > es;
xr2 = xi2 - n(xi2)/dn(xi2);
fxr2 = n(xr2);
ea = abs((xr2-xi2)/xr2);
fprintf('%e\t\t\t\t\t %e\t\t\t\t\t %e\n', xr2,fxr2,ea);
xi2 = xr2;
end
disp(' ')
disp('-----------------------------------------------------------------------------')
disp(' ')
disp('xi3 = -7')
disp(' ')
disp('xr3
fxr3
ea')
disp('_____________________________________________________________________________')
es=0.0000001;
n = @(s)(s^3 + 9*s^2 + 26*s + 24);
dn = @(s)(3*s^2 + 18*s + 26);
ea = 100;
xi3 = -7;
while ea > es;
xr3 = xi3 - n(xi3)/dn(xi3);
fxr3 = n(xr3);
ea = abs((xr3-xi3)/xr3);
fprintf('%e\t\t\t\t\t %e\t\t\t\t\t %e\n', xr3,fxr3,ea);
xi3 = xr3;
end
disp(' ')
disp('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$')
disp(' ')
disp('Roots for Denominator')
disp(' ')
disp('Xi1 = 0');
disp(' ')
disp('Xr1
fXr1
ea')
disp('_____________________________________________________________________________')
es=0.0000001;
r = @(s)(s^4 + 15*s^3 + 77*s^2 + 153*s + 90);
dr = @(s)(4*s^3 + 45*s^2 + 154*s + 153);
ea = 100;
Xi1 = 0;
while ea > es;
Xr1 = Xi1 - r(Xi1)/dr(Xi1);
fXr1 = r(Xr1);
ea = abs((Xr1-Xi1)/Xr1);
fprintf('%e\t\t\t\t\t %e\t\t\t\t\t %e\n', Xr1,fXr1,ea);
Xi1 = Xr1;
end
disp(' ')
disp('-----------------------------------------------------------------------------')
disp('Xi2 = -2.6');
disp(' ')
disp('Xr2
fXr2
ea')
disp('_____________________________________________________________________________')
es=0.0000001;
r = @(s)(s^4 + 15*s^3 + 77*s^2 + 153*s + 90);
dr = @(s)(4*s^3 + 45*s^2 + 154*s + 153);
ea = 100;
Xi2 = -2.6;
while ea > es;
Xr2 = Xi2 - r(Xi2)/dr(Xi2);
fXr2 = r(Xr2);
ea = abs((Xr2-Xi2)/Xr2);
fprintf('%e\t\t\t\t\t %e\t\t\t\t\t %e\n', Xr2,fXr2,ea);
Xi2 = Xr2;
end
disp(' ')
disp('-----------------------------------------------------------------------------')
disp('Xi3 = -2');
disp(' ')
disp('Xr3
fXr3
ea')
disp('_____________________________________________________________________________')
es=0.0000001;
r = @(s)(s^4 + 15*s^3 + 77*s^2 + 153*s + 90);
dr = @(s)(4*s^3 + 45*s^2 + 154*s + 153);
ea = 100;
Xi3 = -2;
while ea > es;
Xr3 = Xi3 - r(Xi3)/dr(Xi3);
fXr3 = r(Xr3);
ea = abs((Xr3-Xi3)/Xr3);
fprintf('%e\t\t\t\t\t %e\t\t\t\t\t %e\n', Xr3,fXr3,ea);
Xi3 = Xr3;
end
disp(' ')
disp('-----------------------------------------------------------------------------')
disp('Xi4 = -7');
disp(' ')
disp('Xr4
fXr4
ea')
disp('_____________________________________________________________________________')
es=0.0000001;
r = @(s)(s^4 + 15*s^3 + 77*s^2 + 153*s + 90);
dr = @(s)(4*s^3 + 45*s^2 + 154*s + 153);
ea = 100;
Xi4 = -7;
while ea > es;
OUTPUT