Question: Code should be in MATLAB. Thank you! 5. In Problem Set 1, we considered a hemispherical-shaped tank filled with water, which is draining from the

Code should be in MATLAB. Thank you!
Code should be in MATLAB. Thank you! 5. In Problem Set 1,
we considered a hemispherical-shaped tank filled with water, which is draining from

5. In Problem Set 1, we considered a hemispherical-shaped tank filled with water, which is draining from the bottom orifice as shown in Figure 1. wo Figure 1: Water tank with bottom orifice We derived the ODE governing the water level y(t) as dy -rv2g (1) dt (2Rvi - g/2) We now want to find a numerical solution to Eq. (1) using MATLAB. Assume the constants are given as follows. R=0.5 (m) ro = 4 (cm) 9 = 9.81 (m/s) y(0) = R You must submit your code for full credit. (a) (6 points) Solve for y(t) analytically (you get a solution in implicit form) and calculate how long it takes to completely drain the tank (t = tempty). Tempty should be expressed in terms of R. ro and g. (b) (15 points) Implement Euler method to find and plot the numerical solution of (1) for 0 SI S 45 with time step h = 5x 10-7. Your code should consist of the following (1) A function that defines the ODE y = f(ty). (2) A function that implements Euler. (3) A script that calls the first two functions to find the mumerical solution. Hint: Your function defining y = f(y) should contain an if statement to enforce the condition that f(ty) = 0 for y 0)); in your script from (a) to count how many positive entries there are in your numerical solution. (d) (2 points) Plot the numerical solution from your Euler method. Include title, xlabel, and ylabel in your plot

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!