na-lab-newton

Version 1.0.0 (1.15 KB) by Akshay
code
2 Downloads
Updated 14 Nov 2022

View License

clc;
x0=input("enter initial approximation");
syms x;
g=x^2-17;
f=inline(g);
dg=diff(g);
df=inline(dg);
n=input("enter no of iterations");
e=input("Enter tolerance");
for i=1:n
x1=x0-(f(x0)/df(x0));
fprintf("The root is %f\n",x1);
if(abs(x1-x0)<e)
break;
end
x0=x1;
end

Cite As

Akshay (2024). na-lab-newton (https://www.mathworks.com/matlabcentral/fileexchange/120388-na-lab-newton), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2022b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0