# Category: R/Matlab

## Matlab speed comparison of switch-case and if-then statements and hard-code

I frequently use the extremely methodical approach in scientific programming of “just trying things”. This means that I create a lot of different ways to try to do something to find the best way to do that thing. Sometimes this means getting a realistic result, a stable result, or a fast computation. All functional programming […]

## Markov Chain stratigraphic model

I recently returned from the NCED2 Summer Institute for Earth Surface Dynamics at Saint Anthony Falls Laboratory at University of Minnesota, which is a 10-day long, intense workshop for early-career scientists to talk about novel methods and ideas in our field. This was the ninth, and hopefully not last, year of the meeting. Typically the […]

## Outreach module — Flooding risk in low-lying landscapes

I have put together an outreach module that describes some of the risks of flooding in low-lying landscapes. The module runs in Matlab, either within a licensed environment, or with the Matlab Runtime Environment (which is available to anyone). Accompanying the GUI is a worksheet that steps through all the aspects of the GUI and […]

## Building a simple delta numerical model: Part VI

This will be the final piece of the model that we need to get to have a working code for delta growth: the time routine. We will define a few more terms in order to set up the model to be able to loop through all the time steps and update the evolving delta. T […]

## Building a simple delta numerical model: Part V

Now we need to add a routine to update the channel bed, based upon the calculated change in sediment transport over space from the previous step. We’ll use the calculation from the last Part of the tutorial (get_dqsdx) in order to update the channel bed (η) at the end of each timestep. Define the following […]

## Building a simple delta numerical model: Part IV

In this part of “Building a simple delta numerical model”, we’ll write the part of our model that will solve the “Exner” equation, which determines changes in bed elevation through time. We’ll start with the module in this post, and then implement the time-updating routine in the next post of this series. We’re going to make […]

## Building a simple delta numerical model: Part III

In this part of “Building a simple delta numerical model”, we’ll simply develop a module for calculating sediment transport at all locations within our model domain. This is naturally a critical piece of the model to get right, because the magnitude of sediment transport that occurs within the delta system will have a direct correlation […]

## Building a simple delta numerical model: Part II

Taking the simpler form of the backwater equation, that is, assuming that width does not vary over the channel reach, we find an expression for changing flow depth H along the channel streamwise coordinate x: (Equation 1)where S is the channel bed slope, Cf  is the dimensionless coefficient of friction, and Fr is the Froude number: (Equation 2) A couple […]

## Building a simple delta numerical model: Part I

This is the first in a series I’m going to write over an undetermined-number-of-parts series where we will develop all the pieces to a simple delta numerical model. I’ll outline all the pieces here while I work up an interactive version with a GUI in Matlab, and we write pieces of the code together within the […]

## Dietrich Settling Velocity Matlab code

Just about two years ago, I published a code for calculating the settling velocity of a particle in water by the Dietrich, 1982 method. I later realized an error in the code that made it produce erroneous estimates. I replaced it with a corrected version of the code written in R, that you can still find on […]