Matlab Scripts

Matlab is a wonderful tool to rapidly implement algorithms and check results. Additionally, many powerful computational tools are included in the program's toolboxes. Below you can find some Matlab scripts for structural geology and basin analysis. For the fault related folding and basin analysis sections, each group of scripts is archived in a zip file which includes a readMe.txt file. Make sure to read this file before using the scripts. All scripts are copyright of Nestor Cardozo and are intended for non-profit purposes. I assume no liability for damages, direct or consequential, that may result from the use of the scripts. If you use these scripts in a publication, please acknowledge them.

Structural Geology Algorithms:


A full suite of Matlab functions from our book Structural Geology Algorithms: Vectors and Tensors, by Richard Allmendinger, Nestor Cardozo and Donald Fisher. These functions solve several problems in Structural Geology involving vectors (lines and planes) and tensors (stress and strain). The functions can be downloaded from this link (updated June 30, 2020). Make sure to check the book!

Fault related folding:

NOTE: You need the Matlab Optimization Toolbox in order to run the optimized trishear inversion scripts

The optimized trishear inversions above are highly affected by local minima (
Cardozo and Aanonsen, 2009). To avoid being trapped in local minima, genetic and direct search algorithms can be used. The scripts below are new versions of 2D and 3D optimized trishear inversions using pattern search and simulated annealing algorithms (Cardozo et al. 2011).

NOTE: You need the Global Optimization toolbox in order to run the optimized trishear inversions with pattern search or simulated annealing algorithms


2D, forward and inverse trishear on listric propagating thrusts (Cardozo and Brandenburg, 2014). This research was funded by Shell.

3D, forward trishear on listric propagating thrusts (
Cardozo and Brandenburg, 2014, and pseudo-3D trishear in Cardozo, 2008).

Basin analysis: