Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Flow of water into barrel = 36.8 lb/sec The height of the water = h = weight of

ID: 2994716 • Letter: F

Question



Flow of water into barrel = 36.8 lb/sec



The height of the water = h = weight of the water in the barrel

--------------------------------------------

(density of water)(bottom area of barrel)


Flow out of the barrel is related to the depth of the water in the barrel. The deeper the water in the barrel the faster it will flow out. For this barrel the water flow out in lb/sec is = 9.2*h.


The factor 9.2 is called the a leak factor. Where h is the height of the water in the barrel.

The area of the barrel is A = 4.60 ft2.

The density of water is p = 62.4 lb/ft3.


Part 1: Use MATLAB to develop a mathematical model of the water filling the barrel. Generate water height with time data in your model. Your time should run from t = 1 second to 250 seconds. (Dont worry about the barrel overflowing. It will come to a steady state height. ) Use an fprintf command to display the water height at t= 250 seconds. You may suppress all other output in this section.


Part 2: Using MATLAB, generate a theoretical water level height with time. Uses an fprintf statement to show the theoretical height at 250 seconds. Suppress the other output in this section.


Htheo(t) = (36.8/9.2)(1-exp(-9.2t/pA) Which can be simplified to htheo(t) = 4(1-exp(-.032t))


Part 3: Make a graph of Height vs. time for part 1 and part 2 on the same graph. Use some type of customizing on your graph lines to distinguish the plots. The graph should be labeled and titled properly.   

Explanation / Answer

clear all;
clc;

inflow = 36.8;
area = 4.60;
density = 62.4;
step = 0.5; %Indicates the time step for analysis.

loopvar = 1;
for(t=0:step:250)
    if(loopvar > 1)
        height(loopvar) = height(loopvar - 1) + inflow/density/area*step;
    else
        height(loopvar) = inflow/density/area*step;
    end
    outflow = 9.2*height(loopvar)*step;
    height(loopvar) = height(loopvar) - outflow/density/area;
    height_theoretical(loopvar) = 4*(1-exp(-0.032*t));
   
    time(loopvar) = t;
    loopvar = loopvar + 1;
end

plot(time,height,'blue',time,height_theoretical,'red')
legend('Actual Height','Theoretical Height');
%BLue line indicates actual height and Red line indicates tehoretical height