Question
MATLAB CODE function mybisect( f,xl,xu,n ) c=feval(f, xl); d=feval(f, xu); if c*d>0.0 error('Function has same sign at both endpoints') end for i=1:n xr=(xl+xu)/2; yr=feval(f,xr); e=abs((xl-xu)/xr);
MATLAB CODE
function mybisect( f,xl,xu,n ) c=feval(f, xl); d=feval(f, xu); if c*d>0.0 error('Function has same sign at both endpoints') end for i=1:n xr=(xl+xu)/2; yr=feval(f,xr); e=abs((xl-xu)/xr); if c*yr<0.0 xu=xr; else xl=xr; end disp([i xl xu xr e]) end |
(a). Modify the code to find the root until the error (e) reached 1% using Bisection Method without showing iteration. Also find out the root of equation, f(x)=1+3x-x2, Use initial and upper guesses 1 and 5
(b). Solve the above problem by graphical method (use fplot)
Please write full code (Full Answer )
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