Using matlab find all the roots of the following function in
Using matlab, find all the roots of the following function in the interval 0.5<=z<=5.
f(x) = (2/x-x)cos(x)+0.0119
Each root must be accurate to a minimum of six significant figures. Use either the bisect or false position methods.
What is the conclusion regarding the results?
Solution
MATLAB CODE :
clc;
clear all;
fun= @(x) (2/x - x)*cos(x)-0.0119; % function in terms of x
x0=[0.5 5]; % initial interval
x=fzero(fun,x0); % roots
display(x);
CONCLUSION : There is one in that interval and it is equal to 4.7096
