0% found this document useful (0 votes)
13 views5 pages

Root-Finding Methods in MATLAB

The document outlines various numerical methods for finding roots of equations, including the False Position Method, Secant Method, Newton-Raphson Method, Successive Approximation Method, and Bisection Method. Each method is accompanied by its algorithm and a corresponding MATLAB program implementation. The document serves as a guide for implementing these root-finding techniques in MATLAB.

Uploaded by

suhaninikam05
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views5 pages

Root-Finding Methods in MATLAB

The document outlines various numerical methods for finding roots of equations, including the False Position Method, Secant Method, Newton-Raphson Method, Successive Approximation Method, and Bisection Method. Each method is accompanied by its algorithm and a corresponding MATLAB program implementation. The document serves as a guide for implementing these root-finding techniques in MATLAB.

Uploaded by

suhaninikam05
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

False Position Method

 Algorithm:  MATLAB Program:


1. Choose initial guesses x0 and x1 such that
f(x0)*f(x1) < 0. function root = false_position(f, x0, x1, tol)
2. Compute x2 using the formula: while abs(f(x1)) > tol
x2 = x1 - [f(x1) * (x1 - x0)] / [f(x1) - f(x0)]. x2 = x1 - (f(x1) * (x1 - x0)) / (f(x1) - f(x0));
3. Check the stopping condition if abs(f(x2)) < tol
f(x2)| < tolerance or |x2 - x1| < tolerance. break;
4. Update x0 = x1 and x1 = x2; repeat until end
convergence. if f(x0) * f(x2) < 0
x1 = x2;
else
x0 = x2;
end
end
root = x2;
End
Secant Method

 Algorithm:  MATLAB Program:

1. Choose initial guesses x0 and x1. function root = secant_method(f, x0, x1, tol)
2. Compute x2 using the formula: while abs(x1 - x0) > tol
x2 = x1 - f(x1) * (x1 - x0) / (f(x1) - f(x0)). x2 = x1 - f(x1) * (x1 - x0) / (f(x1) - f(x0));
3. Check the stopping condition |x2 - x1| < x0 = x1;
tolerance. x1 = x2;
4. Update x0 = x1 and x1 = x2; repeat until end
convergence. root = x1;
end
Newton-Raphson Method
 Algorithm: function root = newton_raphson(f, df, x0,
1. Choose an initial guess x0. tol)
2. Compute the next approximation using: while true
x1 = x0 - f(x0) / f'(x0). x1 = x0 - f(x0) / df(x0);
3. Check the stopping condition if abs(x1 - x0) < tol
|x1 - x0| < tolerance. break;
4. Update x0 = x1; repeat until convergence. end
x0 = x1;
end
root = x1;
end

 MATLAB Program:
Successive Approximation Method

 Algorithm:  MATLAB Program:


1. Rewrite f(x) = 0 as x = g(x). function root = successive_approximation(g,
2. Choose an initial guess x0. x0, tol)
3. Compute x1 = g(x0). while true
4. Check the stopping condition |x1 - x0| < x1 = g(x0);
tolerance. if abs(x1 - x0) < tol
5. Update x0 = x1; repeat until convergence. break;
end
x0 = x1;
end
root = x1;
end
Bisection Method
 Algorithm:
1. Choose initial guesses x0 and x1 such  MATLAB Program:
that f(x0)*f(x1) < 0. function root = bisection_method(f, x0, x1, tol)
2. Compute midpoint: while abs(x1 - x0) > tol
xm = (x0 + x1) / 2. xm = (x0 + x1) / 2;
if abs(f(xm)) < tol
3. Check the stopping condition
break;
|f(xm)| < tolerance.
end
4. Update the interval: if f(x0) * f(xm) < 0
- If f(x0)*f(xm) < 0, set x1 = xm. x1 = xm;
- Else, set x0 = xm. else
5. Repeat until convergence. x0 = xm;
end
end
root = (x0 + x1) / 2;
end

You might also like