Introduction to Spectral Analysis and Matlab


The objective of this lab is to explore the relationship between the time domain and the frequency domain using MATLAB. You will first look at pure sine waves as a function of time and their representation in the frequency domain, and then examine some earthquake data.



Supporting Resources

Lab Write Up
Slide Presentation
Data files and Matlab scrips

MATLAB is a commonly used commercial package designed to manipulate and plot all sorts of data.  The MATLAB introduction states:

MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation.  Typical uses include:
•    Math and computation
•    Algorithm development
•    Modeling, simulation, and prototyping
•    Data analysis, exploration, and visualization
•    Scientific and engineering graphics

MATLAB is an interactive system whose basic data element is an array that does not require dimensioning. This allows you to solve many technical computing problems, especially those with matrix and vector formulations, in a fraction of the time it would take to write a program in a scalar noninteractive language such as C.

Today's lab will use only a few of the features offered by MATLAB, but should give you enough of an introduction to allow you to understand the basic syntax, input/output and plotting.

Author: John Taber, IRIS Consortium (

Updated 5/30/14: Rob Anthony, NMT  (