Problem 57879. Route a hydrograph through a river section with the Muskingum method

Problem statement
Write a function that routes a hydrograph through a river section using the Muskingum method. The input to the function will be the inflow hydrograph I(t), the times t at which the hydrograph is reported, the routing parameters K and X, and the desired time step dt. If the desired time step differs from the time step in the given inflow hydrograph, use linear interpolation to get the inflow hydrograph onto the new time base. Return the time base of the outflow hydrograph, the outflow hydrograph O(t), and a Boolean flag that says whether the time step is within the guidelines 2KX <= dt < 2K(1-X).
Bonus points to anyone who can solve this problem using the FILTER command.
Background
Hydrologic routing is used to predict the movement of a flood wave in a river. The Muskingum method is an example of hydrologic routing, in which the inflow I and outflow O are connected to the storage S in a channel section through a conservation of mass (or volume), which states that the rate of change of storage is the difference between the inflow and outflow:
dS/dt = I - O
This equation is written in discretized form as
(S2-S1)/dt = (I1+I2)/2-(O1+O2)/2
where subscripts 1 and 2 denote the previous and current time steps, respectively. In applications, the inflow hydrograph (or flow as a function of time) is known, and we assume that everything at the previous time step is known. That assumption leaves two unknowns, the current outflow O2 and the current storage S2.
In the Muskingum method, the storage, inflow, and outflow are further related by
S = K[XI + (1-X)O]
where K is a time scale related to travel time in the river section and X is a weighting factor. Substituting this relation into the discretized form of conservation of mass and rearranging gives
O2 = C0 I2 + C1 I1 + C2 O1
where
C0 = (dt - 2KX)/(2K(1-X)+dt)
C1 = (dt + 2KX)/(2K(1-X)+dt)
C2 = (2K(1-X)-dt)/(2K(1-X)+dt)
Notice that C0+C1+C2 = 1. With the assumption that the first value of the outflow equals the first value of the inflow, this equation for O2 can be used to compute the outflow hydrograph. The guideline for dt above ensures that the coefficients C0, C1, and C2 are positive.

Solution Stats

7.14% Correct | 92.86% Incorrect
Last Solution submitted on Feb 28, 2024

Solution Comments

Show comments

Problem Recent Solvers2

Suggested Problems

More from this Author249

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!