Question
Can you help us figure out how to code this problem in Matlab? Below is the bisection code which we need to use. We do
Can you help us figure out how to code this problem in Matlab? Below is the bisection code which we need to use. We do not know how to create a function for this problem
function bisection(func,ab,tolx,tolfx)
%func is the nonlinear function %ab is the bracketing interval [a,b] %tolx is the tolerance for error in estimating error %tolfx is the tolerance for error in function value at solution
maxiters=50; %maximum number of iterations allowed
a=ab(1); b=ab(2); fa=feval(func,a); %evaluate function at a fb=feval(func,b); %evaluate function at b
fprintf(' # root f(x) ');
for i=1:maxiters x=(a+b)/2; fx=feval(func,x); fprintf('%3d %7.6f %7.6f ', i,x,fx); if (abs(fx)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started