Uploaded by regenemae.taculao

chegg-ans

advertisement
<< Search more Solutions!
Found Errors in Solution? >> Report here!
Note: If you are getting wrong answer or irrelevant answer, We suggest you to cross-verify the link you submitted is
directing to the right question you looking for? Sometimes the site you are using for searching questions may not giving you
the right link to the question. To avoid getting this error: Search your question on Google and open the question page
and grab the direct link to your question and try again!
Answer
display('Equation is v=(g*m/c)(1-exp(-(c/m)*t))')
%Given:
g=9.8; c=15; t=9; v=35;
%initial guess
m0=50; %ml
m1=60; %mh
e=0.001; %tolerance
f =@(m) ((g*m/c)*(1-exp(-(c/m)*t)))-v; %we need to find roots of this equation
m2_old=0;
for i=0:inf
m2= m1-(f(m1)* (m1-m0)/(f(m1)-f(m0))) ;
if abs(f(m2)-f(m2_old))<e
break;
end
m2_old=m2;
if f(m0)*f(m2) <0
m1=m2;
continue
else
m0=m2;
continue
end
end
fprintf('the value of m of is %d',m2)
--------------------------Sample output:
Equation is v=(g*m/c)(1-exp(-(c/m)*t))
the value of m of is 59.841
Likes: 2
Dislikes: 0
Download