na-lab-secant

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

View License

clc;
syms x;
g=x^2-17;
f=inline(g);
x0=input("Enter first approximation");
x1=input("Enter second approximation");
n=input("enter no of of iterations");
e=input("Enter tolerance");
for i=1:n
x2=x1-((x1-x0)/(f(x1)-f(x0)))*f(x1);
fprintf("the value of root is %f\n",x2);
if(abs(x2-x1)<e)
break;
end
x0=x1;
x1=x2;
end

Cite As

Akshay (2024). na-lab-secant (https://www.mathworks.com/matlabcentral/fileexchange/120393-na-lab-secant), 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