MATLAB The following question needs to be programmed in MATL

(MATLAB) The following question needs to be programmed in MATLAB.

3. Find a root of the equation tan x x on the interval [4, 5] by using the bisection method. What happens on the interval [1, 2]?

Solution

a = 4;
b = 5;
f = @(x) tan(x) - x;
p = (a + b)/2;
err = abs(f(p));
while err > 1e-7
if f(a)*f(p)<0
b = p;
else
a = p;
end
p = (a + b)/2;
err = abs(f(p));
end
  
disp(p);

in the interval [4,5] root is 4.4934. In the interval [1,2] the solution does not converge. (the program will run endlessly)

(MATLAB) The following question needs to be programmed in MATLAB. 3. Find a root of the equation tan x x on the interval [4, 5] by using the bisection method. W

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site