0% found this document useful (0 votes)
48 views1 page

Bisection Method for Finding Roots

This document outlines an algorithm to find the root of an equation using the bisection method with a specified level of accuracy. It defines a cubic function, takes user input for an initial x-value and desired accuracy. It then iteratively calculates the midpoint between values where the function changes sign until the result is within the specified accuracy, at which point it outputs the root.

Uploaded by

rahul.yerrawar
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)
48 views1 page

Bisection Method for Finding Roots

This document outlines an algorithm to find the root of an equation using the bisection method with a specified level of accuracy. It defines a cubic function, takes user input for an initial x-value and desired accuracy. It then iteratively calculates the midpoint between values where the function changes sign until the result is within the specified accuracy, at which point it outputs the root.

Uploaded by

rahul.yerrawar
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

Bisection method with accuracy

clc;
clear all;
close all;
f=(@(x)((x^3))-x-11);
x=(input('enter the value of x =');
acc=(input('enter the accuracy=');
while((f(x1)*f(x2))>0)
x=input('enter the new value of x=');
end
x3=(x1+x2)/2;
if f(x3)>acc;
x2=x3;
else
x1=x3;
end
x3=(x1+x2)/2;
fprintf('the root of equation is %f,''x1')

You might also like