NA-lab-bisection

Version 1.0.0 (1.19 KB) by Akshay
code
1 Download
Updated 14 Nov 2022

View License

clc;
f=@(x) x^2-29;
a=input("Enter lower bound");
b=input("Enter upper bound");
e=input("Enter tolerance");
if(f(a)*f(b)<0)
while(abs(a-b)>e)
c=(a+b)/2;
if(f(a)*f(c)<0)
b=c;
elseif(f(b)*f(c)<0)
a=c;
else
break;
end
fprintf("The root is %0.4f\n",c);
end
else
fprintf("Not possible sign doesnt change in given interval");
end

Cite As

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