0% found this document useful (0 votes)
6 views3 pages

Root Finding Methods in MATLAB

MATLAB offers built-in functions `fzero` and `fsolve` for root-finding, utilizing methods like Newton-Raphson and Bisection internally. The document outlines these methods, providing examples and comparisons, highlighting their convergence speed and requirements. It suggests using `fzero` for single-variable equations and `fsolve` for systems of nonlinear equations, while also recommending custom implementations for Bisection or False Position methods when needed.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Root Finding Methods in MATLAB

MATLAB offers built-in functions `fzero` and `fsolve` for root-finding, utilizing methods like Newton-Raphson and Bisection internally. The document outlines these methods, providing examples and comparisons, highlighting their convergence speed and requirements. It suggests using `fzero` for single-variable equations and `fsolve` for systems of nonlinear equations, while also recommending custom implementations for Bisection or False Position methods when needed.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Root-Finding Methods in MATLAB

MATLAB provides several tools to find the roots of equations (i.e., the values of x for which
f(x) = 0). While it does not have separate commands explicitly named for Newton-Raphson,
Bisection, or False Position methods, the built-in solvers `fzero` and `fsolve` internally use
these or similar iterative algorithms for robust and efficient root finding.

1. Newton–Raphson Method
The Newton–Raphson method is an open iterative technique that uses the derivative of a
function to converge rapidly toward a root. In MATLAB, this is implemented internally in
the `fzero` and `fsolve` functions.

Example for a single equation using fzero:

f = @(x) x^3 - 5*x + 3;


root = fzero(f, 1); % Initial guess near the root
disp(root)

Example for a system of nonlinear equations using fsolve:

fun = @(X) [X(1)^2 + X(2)^2 - 4;


X(1)*X(2) - 1];
sol = fsolve(fun, [1,1]); % Initial guesses
disp(sol)

2. Bisection Method
The Bisection method is a bracketing technique that repeatedly halves an interval
containing the root. In MATLAB, `fzero` automatically starts with a bisection step when you
provide an interval [a, b] where f(a) and f(b) have opposite signs.

Example:

f = @(x) x^3 - 4*x + 1;


root = fzero(f, [0, 2]); % Bracketing interval
disp(root)
3. False Position (Regula Falsi) Method
The False Position method is similar to the Bisection method but uses linear interpolation
between endpoints. MATLAB does not have a direct built-in command for this method, but
it can be implemented easily.

Example implementation:

f = @(x) x^3 - x - 2;
a = 1; b = 2;
for i = 1:20
fa = f(a); fb = f(b);
c = (a*fb - b*fa) / (fb - fa); % False position formula
fc = f(c);
if fa*fc < 0
b = c;
else
a = c;
end
if abs(fc) < 1e-6, break; end
end
disp(['Root ≈ ', num2str(c)])

4. Comparison of Root-Finding Methods in MATLAB


Method MATLAB Command Type Notes

Newton–Raphson fzero, fsolve Open Fast convergence;


needs derivative or
good initial guess

Bisection fzero (with [a,b]) Bracketing Always converges;


slower

False Position Custom code / fzero Bracketing Faster than


bisection but may
stall

Secant fzero Open Derivative-free;


moderate
convergence

Hybrid (default) fzero Mixed Combines bisection


+ secant + Newton
for reliability

5. Summary
• Use `fzero` for single-variable equations — it automatically combines bisection, secant,
and Newton steps for efficiency.
• Use `fsolve` for systems of nonlinear equations — it relies on Newton-type iterations.
• Implement your own Bisection or False Position method if you need to demonstrate the
numerical procedure explicitly.

You might also like