0% found this document useful (0 votes)
39 views2 pages

Metode Newton Raphson - Genap

Uploaded by

Rielsa
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)
39 views2 pages

Metode Newton Raphson - Genap

Uploaded by

Rielsa
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/ 2

%Metode Newton Raphson - Galat

clear all;
clc;

disp('METODE NEWTON RAPHSON - GALAT');


disp('=============================');

syms x;
f = 8*x^4 - 4*sin(x) + 2*x
ft = 32*x^3 - 4*cos(x) + 2
x0 = 2
galat = 0.0001;

fxr = subs(f, x0);


ftxr = subs(ft, x0);
xr = x0-(fxr/ftxr);
e = abs(xr-x0);
i = 1;

disp(' i xr f(xr) ft(xr) xr


baru e');
disp('============================================================================'
fprintf('%3.d %10.6f %10.6f %10.6f %10.6f %10.6f\n', i, x0, fxr, ftxr,
xr, e);

while e > galat


i = i + 1;
x0 = xr;
fxr = subs(f, x0);
ftxr = subs(ft, x0);
xr = x0 - (fxr/ftxr);
e = abs (xr-x0);
fprintf('%3.f %10.6f %10.6f %10.6f %10.6f %10.6f\n', i, x0, fxr,
ftxr, xr, e);
end;

disp('---------------------------------------')
fprintf('Maka nilai akar persamaan = %.6f\n', xr)

METODE NEWTON RAPHSON - GALAT


=============================

f =

2*x - 4*sin(x) + 8*x^4

ft =

32*x^3 - 4*cos(x) + 2

1
x0 =

i xr f(xr) ft(xr) xr baru


e
============================================================================
1 2.000000 128.362810 259.664587 1.505659 0.494341
2 1.505659 40.134458 110.966632 1.143979 0.361680
3 1.143979 12.348107 48.251633 0.888068 0.255911
4 0.888068 3.648658 21.888772 0.721377 0.166691
5 0.721377 0.967482 11.009020 0.633496 0.087881
6 0.633496 0.187574 6.911615 0.606357 0.027139
7 0.606357 0.014648 5.847130 0.603852 0.002505
8 0.603852 0.000118 5.753370 0.603832 0.000020
---------------------------------------
Maka nilai akar persamaan = 0.603832

Published with MATLAB® R2020a

You might also like