Solve using MATLAB. method for root-finding Exercise 3: Bisection This question
ID: 2073528 • Letter: S
Question
Solve using MATLAB.
Explanation / Answer
function [ x ] = bisection( fun,a,b,maxtol,maxitr)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
if fun(a)*fun(b)>0
disp('take some other values of a and b')
else
k=1;
x(k)= (a+b)/2;
err=abs(fun(x));
while (err > maxtol && k < maxitr)
if fun(a)*fun(b)<0
b=x(k);
else
a=x(k);
end
x(k+1)=(a+b)/2;
err= abs(fun(x(k+1)));
k=k+1;
end
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.