strainz17: Earthquake Strains and Rotations

strainz17.m and associated software is for inference of dynamic ground strains and rotations and their errors from short baseline array observations of ground motions.

We present Matlab®-language software that implements the method of Spudich et al. (1995) and Spudich and Fletcher (2008) to calculate the best fitting uniform strain and rigid-body rotation time series and their formal errors, given array measurements of ground motions. This example includes example input, example output, and a script for running the example.

Download strainz17 ZIP file (700 Kb)

Compressed file containing 21 files. This file may be uncompressed on a Windows machine using PKUNZIP, WinZip, or other software. On a Mac this file can be uncompressed using StuffIt Expander or other software. On linux/unix the file may be uncompressed using the unzip command.

Contents of the zip file:

Comments on the Example

This example has four goals: 1) to verify that when you run strainz17, you obtain the same results that we obtain with the same input, 2) to show how to set up the input variables for the case in which the analysis is done for a 10-station subarray of a 14-station array, 3) to show the Matlab novice user how to take seismograms from ascii data files and place them into the input structure that strainz17 requires, and 4) to show the Matlab novice how to extract, plot, and save numerical output from the strainz17 output structure. The function make_example_in_structure.m is aimed at goal 3, and the function plot_save_strainz_output1.m is aimed at goal 4. Both of these functions are not intended to be general input or output routines. Instead, they are written to be simple and easily understandable.

The time series of the example are not real seismograms.

Running the Example

To run this example, uncompress the zip file. A folder/directory named example17a should be created. Make that directory your current/working directory while in the Matlab environment. At the Matlab '>>' prompt, invoke the script by typing RUN_THE_EXAMPLE, and if all goes well you will see the following:

Vp =
Vs =
Reading data from file stn1.txt
Reading data from file stn2.txt
Reading data from file stn3.txt
Reading data from file stn4.txt
Reading data from file stn5.txt
Reading data from file stn6.txt
Reading data from file stn7.txt
Reading data from file stn8.txt
Reading data from file stn9.txt
Reading data from file stn10.txt
Reading data from file stn11.txt
Reading data from file stn12.txt
Reading data from file stn13.txt
Reading data from file stn14.txt
In strainz17, matrix condition number = 5.3522
Saving plot in file plot_save_strainz_output1.pdf
Saving numerical results in file plot_save_strainz_output1.mat
Saving numerical results in ascii file ascii_output.txt

The example creates a plot on the screen and three output files:

  1. plot_save_strainz_output1.pdf - a pdf version of the figure on the monitor.
  2. plot_save_strainz_output1.mat - a Matlab '.mat' file containing the complete numerical output of strainz17 in full precision. See the strainz17.m comments for a detailed description of the output. The file plot_save_strainz_output1.mat contains a structure name szo which can be compared with the identically-named structure in our output file our_example_strainz_output.mat, included in the zip file. Your results should agree with ours to 13 or 14 significant figures.
  3. ascii_output.txt - an ascii file containing a subset of the rotation and strain time series printed to limited precision. This file should agree exactly with our output file our_example_ascii_output.txt included in the zip file. Row/record i of ascii_output.txt contains:

Column 1: t(i), an artificial example time assigned to row i
Column 2: maximum shear strain at time t(i)
Column 3: dilatation at time t(i)
Column 4: rotation (rad) about the x1 axis at time t(i)
Column 5: rotation (rad) about the x2 axis at time t(i)
Column 6: rotation (rad) about the x3 axis at time t(i)
Column 7: mistfit ratio at time t(i)

Development Environment and Warning About Line Ends

The distributed files were created on an Apple Macintosh computer runing OS X version 10.5.5 using Matlab Version R2008a. ASCII files on the Mac (e.g. *.m, *.txt) use the newline character as the line/record terminator. PCs use carriage-return newline. If our text files do not wrap text properly on your computer, you might need to replace our line-end characters with yours.


It is the complete responsibility of the users of this software to verify that the software produces results that are sufficiently accurate to be acceptable to the user. Although this software has been used by the US Geological Survey, no warranty, expressed or implied, is made by the USGS or the United States Government as to the accuracy and functioning of the software and related program material, nor shall the fact of distribution constitute any such warranty, and no responsibility is assumed by the USGS in connection therewith.