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.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site