Use the Bisection Method to calculate the solution of cosx
Use the Bisection Method to calculate the solution of cosx = sin x in the interval [0,1] within
six correct decimal places.
**NEEDS MATLAB CODE
Solution
root = 0.785397529602051
Matlab code:
format long;
a = 0;
b = 1;
c = a;
EPSILON = 0.000001;
while ((b-a) >= EPSILON)
c = (a+b)/2;
if (sin(c) - cos(c) == 0.0)
break;
elseif ((sin(c)-cos(c))*(sin(a)-cos(a)) < 0)
b = c;
else
a = c;
end
end
root=c
![Use the Bisection Method to calculate the solution of cosx = sin x in the interval [0,1] within six correct decimal places. **NEEDS MATLAB CODESolutionroot = 0. Use the Bisection Method to calculate the solution of cosx = sin x in the interval [0,1] within six correct decimal places. **NEEDS MATLAB CODESolutionroot = 0.](/WebImages/43/use-the-bisection-method-to-calculate-the-solution-of-cosx-1135083-1761607342-0.webp)