test mixed signals Using binary search method to develop a m


test mixed signals

Using binary search method to develop a matlab code to figure out the one root between [0.1] for equation f(x) = x^9 + x- 1.

Solution

myfunction = @(x) x.^9 + x - 1;

x_lower = 0;
x_upper = 1;

x_mid = (x_lower + x_upper)/2;

while abs(myfunction(x_mid)) > 0.00001
    if(myfunction(x_mid)*myfunction(x_upper)) < 0
        x_lower = x_mid;
    else
        x_upper = x_mid;
    end
    x_mid = (x_lower + x_upper)/2;
end

disp(x_mid);

Root is 0.8243.

 test mixed signals Using binary search method to develop a matlab code to figure out the one root between [0.1] for equation f(x) = x^9 + x- 1.Solutionmyfuncti

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site