Duncan Carlsmith, University of Wisconsin-Madison, Physics
Author Profile


Foundational computational skills for physics students can be developed in an introductory 2-semester survey course for first-year university physics students using physics-data-driven exercises that introduce modelling, analysis, and visualization methods normally reserved for an upper-level undergraduate or graduate level numerical methods course. An example exercise is the reproduction of published LIGO results on compact object mergers from open-source data with a few lines of MATLAB code.

Learning Goals

Access big science open data.
Verify from the data a claim leading to a Nobel prize in physics.
Apply frequency analysis and signal filtering methods to time series data.
Visualize time series data using a power spectrum and a periodogram.
Use cross correlation to identify a coincidence of signals in noisy time series data.

Context for Use

I have introduced a rigorous foundational computational element in the physics curriculum beginning with 1st-year students who intend to major in physics, applied math engineering and physics, or astronomy physics. The physics-forward computation aspect is designed to enhance rather than compromise physics content. MATLAB is used in illustrative weekly online tutorials such as this analysis of LIGO open data. Students apply MATLAB to modelling and analysis of data in weekly hands-on labs as well. For example, they apply the same signal analysis techniques used in LIGO data analysis to acoustic data collected with their cell phones.

Description and Teaching Materials

Each MATLAB tutorial is deployed as CANVAS quiz and can be automatically assessed using multiple choice questions as in this example. Student quiz response submissions such as modified or original executed MATLAB Scripts, images, and plots are assessed using CANVAS Speed Grader. Tutorial instructions supply some scaffolding and a link to a template MATLAB Live Script containing further scaffolding and detailed interleaved commentary. The supplied LIGO data analysis materials are a reproducible pdf of the tutorial quiz (with active hotlinked underlying URLs which could be if printed), a printout of the executed Live Script, and the Live Script itself.

MATLAB Ligo Analysis.docx (Microsoft Word 2007 (.docx) 3.7MB Nov6 19)

LigoAnalysis2Detectors.pdf (Acrobat (PDF) 815kB Nov6 19)

LigoAnalysis2Detectors.mlx (MATLAB Live Script 1MB Nov6 19)

MATLAB LIGO Analysis Quiz.pdf (Acrobat (PDF) 249kB Nov6 19)

Teaching Notes and Tips

The idea of a black hole is most simply introduced by combining the notion of escape velocity from a spherical gravitating body with the upper bound on speed from the special theory of relativity – when the escape speed equals light speed, not even light can escape. The value for the speed of light as determined from observations of the moons of Jupiter as described in Wikipedia is a convenient segue and can be illustrated with a Red Shift Pro (or similar) app movie of the view of Jupiter night after night by setting the time step to 1 day.

A lovely mechanical model of gravitational binaries and radiation is a stretched 2 m diameter membrane supporting co-orbiting ball bearings or marbles. Objects interact by distorting the membrane locally much like space-time is distorted by energy according to General Relativity. (BTW: Launching a cluster of marbles around a heavy object stationary in the middle illustrated the Roche limit.) Even advanced students find this demonstrating fascination. The gravity waves can be detected and recorded with mobile phone inertial sensors. (It is a challenge however to mockup the LIGO-Virgo results as the membrane has reflecting boundaries unlike our universe.)

If you have a tabletop Michelson interferometer, students can get a tangible sense of the sensitivity of such an instrument and find that fascinating. My students acquire and fit published observations of stars orbiting the black hole in Sag A* prior to the LIGO exercise so have already some experience with black hole observations. They also have prior experience in accessing and importing into MATLAB online data sets of various kinds just weeks into their first semester.

The scaffolding provided in the introduction to the activity includes Wikipedia articles written for a general audience. The interested student or instructor can burrow as deeply as they care to in Wikipedia alone to learn more about black hole physics, optical interference and interferometers, gravity waves, and gravity wave detection. My students approach the subject with no training in such matters. A core premise is that playing with the data and making plots are worth a thousand words. The premise applies also to the mathematical methods. Students are assumed to be in Calc 1 only. Fourier analysis is simply presented as a way of approximating a function as a sum of other functions in an earlier activity. Cross correlation has an intuitive explanation and the implementation is trivial – circulate a vector while taking the inner product with another.

Students are just learning MATLAB in this class. The Live Scripts introduce MATLAB functions with a comment indicating what the inputs are, what operations they perform, and what the outputs are. The function name in the comment is hyperlinked to MATLAB documentation so more information and runnable examples of use are a click away. Typically, the default settings for a function suffice but through the activities students come to appreciate and explore different settings. In this way, students lean MATLAB through application, rather like learning a language by speaking it rather than by studying endless verbs and conjugations. The activity requires students study the code and output but not write code. To address the assessment questions, they need only tweak code parameters here and there and understand the plots.

Instructors and students might make use of these materials as reference materials and redesign the assessment to address computation specific or science specific learning goals. For example, students could focus just one of the workspace variables such as one of the time series or function outputs and explore a computational algorithm/function like pspectrum, findpeaks, bandpass, filtfilt, or xcorr in detail.


The activity requires students answer a few questions to test their having met the learning objectives. Answering any of the questions successfully implies the students have accessed the LIGO website, located the needed data, downloaded the data, and successfully run the supplied script that reproduces the result of a single detector. That alone is huge and essentially addresses learning goals 1) and 2) at the level intended. The actual questions probe if the student has understood the code sufficiently to change it to read and compare data from both detectors, and if they can successfully play with some of the parameters used in the analysis such as the widths and number of mechanical resonance signals filtered out to see the impact in the data analysis plots.

Question 1 requires the student understand the power spectra well enough to identify the frequencies of noise resonances. The successful student has acquired the idea of the noise sources limiting the sensitivity of the instrumentation as well as some understanding of how to interpret a power spectrum generally.

Questions 2 requires students understand the cross correlation result well enough to identify the relative time delay implied by a peak in the lags plots shifted away from 0.

Question 3 takes an empirical approach to estimating the uncertainty on the time delay. Uncertainty analysis is an essential aspect of any scientific study and is not neglected here although a thorough analysis is outside the scope of the exercise.

Question 4 addresses the student's ability to use the bandpass filter and peak finding algorithm/functions by themselves adjusting input parameters and then observing the impact of these changes on the analysis results.

These few but incisive questions suffice to assess learning goals 1-5 and more. My first semester students, performing this exercise in week 10, typically ace the questions.

Many extensions are possible by more closely inspecting the data for this single gravity wave event. The LIGO-VIRGO collaboration offers data for many other published events and raw data for inventive searches. This exercise can be a jumping off point for student projects or further exercises which explore other data and could lead to an actual scientific discovery.

References and Resources

The following links are provided in the introductory scaffolding for the exercise and in the script itself and may serve as an adequate introduction to black hole physics and to the MATLAB signal analysis functions invoked.

YouTube video of LIGO Orrery

Gravitational waves (Wikipedia)

First observation of gravitational waves (Wikipedia)

Introduction to general relativity (Wikipedia)

Interferometry (Wikipedia)

Mechanical resonances (Wikipedia)

Fourier analysis (Wikipedia)

Band-stop filter (Wikipedia)

Gravitational wave open science center data source

Spectral estimation (Wikipedia)

Periodogram (Wikipedia)

Cross correlation

Chirp finding algorithm

MATLAB pspectrum (MathWorks)

MATLAB findpeaks (MathWorks)

MATLAB bandpass filter (MathWorks)

MATLAB filtfilt (MathWorks)

MATLAB xcorr (MathWorks)