Write a MATLAB userdefined function that solves tor a root o
Solution
Following are the steps to find the approximate solution of given equation using Bisection method:
Let us assume that we have to find out the roots of f(x), whose solution is lies in the range (a,b), which we have to determine. The only condition for bisection method is that f(a) and f(b) should have opposite signs (f(a) negative and f(b) positive). When f(a) and f(b) are of opposite signs at least one real root between ‘a’ and ‘b’ should exist.
For the first approximation we assume that root to be,
x=(a+b)/2
Then we have to find sign of f(x).
If f(x) is negative the root lies between a and x. If f(x) is positive the root lies between x and b.
Now we have new minimized range, in which our root lies.
The next approximation is given by,
x1 = (a+x)/2………….if f(x) is negative.
x1 = (x+b)/2………….if f(x) is positive.
In this taking midpoint of range of approximate roots, finally both values of range converges to a single value, which we can take as a approximate root.
MATLAB Program For Bisection Method:
Ans (c)
// PLEASE ATTACH THE SIGN OF \'AT THE RATE\' AFTER THE EQUAL TO SIGN AFTER f , as while uploading the answer it was showing to close this character , kindly use it for correct output
![Write a MATLAB user-defined function that solves tor a root of an equation f(x) = 0 using the bisection method. Name the function function [x] = bisection(fun,  Write a MATLAB user-defined function that solves tor a root of an equation f(x) = 0 using the bisection method. Name the function function [x] = bisection(fun,](/WebImages/11/write-a-matlab-userdefined-function-that-solves-tor-a-root-o-1008153-1761520067-0.webp)
