# Matlab programming

Matlab programming - program and plot for water flowing in and out of a tank

Please see attachment. Thanks for your help!

Â© BrainMass Inc. brainmass.com February 24, 2021, 2:13 pm ad1c9bdddfhttps://brainmass.com/computer-science/matlab/matlab-programming-plot-water-flowing-out-tank-7914

#### Solution Preview

Please see the attached file for detailed explanations !

BrainMass Posting Solution

_____________________________________________________________

Posting # CS7914

Solution:

First let us look at what the problem asks and then we shall see how it can be computed using MATLAB. The problem is on rate equations and uses simple calculus to solve these equations.

Simply put, what is happening is that initially the storage tank has some water (half-full) and the vertical height of the water is y (which is assumed to be y = 0 to start with.). So our "origin" is y = 0 and y changes as the water level in the tank changes. The water level in the tank will change according to the outflow (water leaving) and inflow (water entering) of water.

It is given that outflow is at the rate Q = 400m3/day and inflow is at a sinusoidal rate of 3Q sin2t m3/day. [Here d =day, a unit of time]. We are interested in computing the rate at which the water height (y) changes w.r.t. time i.e. dy/dt.

Important note: UNITS.

y = height of water level measured in meters (m).

Q= Rate at which a volume of water is entering/leaving (so its volume/time thus m3/day)

A= cross sectional area of the tank --- always constant--- measured in m2.

Please note that dy/dt has units: length/time (measured in meters/day)

The equation to compute dy/dt follows easily. The height changes due to difference in outflow and inflow rates which is exactly what the equation given states.

Note: Since we are computing dy/dt i.e. rate of change of height, the volume rate must be divided by cross-sectional area A because Volume = ...

#### Solution Summary

The expert plots the water flowing in and out of a tank. The Matlab programming is analyzed.