Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. As shown in the figure above, the velocity of water, v(m/s), discharged from a cylindrical tank through a long pipe can be computed as
3. As shown in the figure above, the velocity of water, v(m/s), discharged from a cylindrical tank through a long pipe can be computed as v=2gHtanh(2L2gHt) where g=9.81m/s2,H= initial head (m),L= pipe length (m), and t= elapsed time (s). Develop a MATLAB script that: (a) plots the function f(H) versus H for H=0 to 4m (make sure to label the plot) and (b) uses the Matlab Bisect M-file in the textbook with initial guesses (brackets) of x1=0 and xu=4m to determine the initial head needed to achieve u=5m/s in 2.5 seconds for a 4-m long pipe. In addition, use Ead =0.0000001. Also, set format long in your script so you display 15 significant digits for your results. (To check your answer, the root is 1.618637502193451) function [root, fx, ea, iter] ] bisect ( func, x],xu, es, maxit, varargin] * bisect: root location zeroes [root, fx, ea, iter] =bisect (func, x1,xu,es, maxit, p1,p2, ): uses bisection method to find the root of func input: func = name of function x1,xu= lower and upper guesses es = desired relative error [default =0.00018 ) maxit = maximum allowable iterations (default = 50) p1, p2, ... = additional paraneters used by func \$ output: root = root estimate fx= function value at root estimate ea = approximate relative error (X) iter = number of iterations if nargin= func (x1, varargin {:}) func (xu, varargin {:}); if test >0,error('no sign change'), end if nargine4 II isempty(es), es =0.0001; end if nargin 0 x1=xr; else ea=0 end if ea en es II iter > maxit, break, end end root =xr;fx=func(xr,varargin{:])
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