I do not know how to solve the shallow water equations in the matrix form in MATLAB. I didn't find anything useful on the internet. I have the specific mathematical equations to solve (please see the picture below) and I must write in MATLAB. If someone has examples, I would appreciate it.

$$\frac{\partial u}{\partial t} - f\nu + g \frac{\partial \eta}{\partial x} = 0$$

$$\frac{\partial \nu}{\partial t} + fu + g\frac{\partial \eta}{\partial y}=0$$

$$\frac{\partial \nu}{\partial t}+H\big(\frac{\partial u}{\partial x} + \frac{\partial \nu}{\partial y}\big)=0$$

  • 4
    $\begingroup$ Have you tried coding it yourself? What you are asking for is a solver, but you need boundary conditions and initial conditions to solve it. Try the Runge-Kutta integration in time. For your spatial derivatives, you may want a finite differencing method. mathworld.wolfram.com/Runge-KuttaMethod.html $\endgroup$ Commented Dec 14, 2016 at 0:03
  • $\begingroup$ lmgtfy.com/… $\endgroup$
    – arkaia
    Commented Dec 14, 2016 at 3:20
  • 1
    $\begingroup$ This certainly sounds like a homework question I had at university too... you learn by doing, not from someone else's work :-) $\endgroup$ Commented Feb 5, 2021 at 15:48

1 Answer 1


You aren't supposed to do link only answers, but that is really all this questions deserves. Did you look on Google? I did.




Those were 3 of the first 9 hits on google, and they all have code examples. There is no close option due to lack of effort, but I'll give it a downvote.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.