Question & Answer: IN MATLAB…..

IN MATLAB

2. Use the bisection method to find the square-root of 10 out to 5 decimal places (i.e. to a relative error of 0.00001). Note: vC=S , so C=S2 , and 0:52-C

Show transcribed image textUse the bisection method to find the square-root of 10 out to 5 decimal places (i.e. to a relative error of 0.00001).

Expert Answer

 

The bisection method unlike the guess and check starts with two values. It runs for an equation and keeps a check on the estimation. The algorithm maintains it’s state with persistent values.

Convert the sqaure-root into an equation and then solve for the value of S. Here is the illustration of the same:

f=@(S) S^2-10;
xO=0;
a=-5;
b=5;
for i=1:100
c=(a+b)/2;
if f(c)>0
b=c;
else
a=c;
end
end
fprintf(‘%fn’,c)

Still stressed from student homework?
Get quality assistance from academic writers!