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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!