The Newton-Raphson algorithm requires the evaluation of two functions (the function and its derivative) per each iteration. If they are complicated expressions it will take considerable amount of effort to do hand calculations or large amount of CPU time for machine calculations. Hence it is desirable to have a method that converges
clear all
clc
tol=0.01;
x0=1;
x1=2;
x=-3:0.1:3;
y=x.^3-3*x+1;
f=@(x)x^3-3*x+1;
plot(x,y)
grid on
z =secant(f,x0,x1,tol);
Cite As
N Narayan rao (2026). secant(f,x0,x1,tol) (https://uk.mathworks.com/matlabcentral/fileexchange/58784-secant-f-x0-x1-tol), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2013a
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
- Mathematics and Optimization > Optimization Toolbox > Systems of Nonlinear Equations > Newton-Raphson Method >
Find more on Newton-Raphson Method in Help Center and MATLAB Answers
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 | none
|