Question

An algorithm for the Bisection method function root Bisect ( x,, x, e, imax) while i s imax x ←(x, +x.)/2 [or 1. ← f(x.) if f. = 0 or (x,-x,) x,+(x,-x,)/2] /r +x, then root ←x exit end if ii +1 if f, × f, < 0 then else end if end while root failed to converge

0 0
Add a comment Improve this question Transcribed image text
Answer #1

%%%PART A,Bisect.m function file

function root=Bisect(xl,xu,eps,imax,f)
i=1;
fl=f(xl);
fprintf(' iteration approximation \n')
while i<=imax
xr=(xl+xu)/2;
fprintf('%6.0f %18.8f \n',i,xr)
fr=f(xr);
if fr==0||((xu-xl)/abs(xu+xl))<eps
root=xr;
return
end
i=i+1;
if fr*fl<0
xu=xr;
else
xl=xr;
fl=fr;
end
end
fprintf('failed to converge in %g iterations\n',imax)

Bisect.m 28 29 30 31 32 function root Bisect (xl, xu,eps, imax, f) fl-f (xl) fprintf ( iteration while i<=imax approximation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

%%%%Part B ,function file

function f=F_v(h)
f=pi*h.^2*(3*4.1-h)/(3)-45;

%%%%%%OUTPUT

Command Window >>hl-Bisect (0,4.1,le-4,20,F_v) 2 iteration approximation 2.05000000 1.02500000 1.53750000 1.79375000 1.921875

%%%%%%%%%%%%%%PART C

%%%%%%FUNCTION FILE

function f=f_velocity(m)
c=13.5;
t=10;
g=9.81;
f=g*m*(1-exp((-c*t)/m))/c-40;

%%RESULT
Command Window >>[h] Bisect (1,100,1e-4,20,@f velocity) 6 iteration approximation 50.50000000 75.25000000 62.87500000 56.6875

Add a comment
Know the answer?
Add Answer to:
An algorithm for the Bisection method function root Bisect ( x,, x, e, imax) while i...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT