Problem 2/MatlabGrader (10 points)
A water tank of radius r with a slit along it's height of width W is mounted in an elevator moving up and down causing a time
dependent acceleration
see Fig. 1.
$g(t)=g_0+a_g \sin(2\pi f_g t)$,
(3)
Figure 1: Water tank inside an elevator
The height of water h(t) in the tank can be modeled by the following ODE,
$\frac{dh}{dt} = \frac{f(t) - \rho \sqrt{g(t)} (W \sqrt{\frac{2}{3}h^3(t)} + \pi r^2 \sqrt{2 \max(0, h(t) - h_p)})}{\rho \pi r^2}$
(4)
where
$f(t)=c[2+\sin(2\pi f_1 t) + \cos(2\pi f_2 t + \sin(2\pi f_3 t))]$,
(5)
models the inflow into the tank. Note the sin is within the cos. Write a Matlab function myRHSEB that takes as input the current
time t and height h and returns the scalar value rhs of the right-hand-side of Eq. (4). Use global variables for all parameters used in
the right-hand-side, i.e., for $g_0, a_g, f_g, \rho, r, W, h_p, c, f_1, f_2, f_3$ use go, ag, fg, rho, rt, W, rp, hp, c, fl,
f2, and f3, respectively. The max appearing in Eq. (4) is returning the larger of the 2 scalar argument values and is implemented
in Matlab as the max function, e.g., max(0, h-hp) is simply max (0, h-hp).
Required submission:
well commented function source code submitted to Matlab Grader