The 'Keeling Curve' and analyzing time series data in MATLAB

Gareth Funning
University of California-Riverside,
Author Profile


In this exercise, we analyze the trends in the CO2 record monitored at Mauna Loa, (the 'Keeling Curve'). This is an exercise in data handling, interpolation, trend estimation and extrapolation.

Used this activity? Share your experiences and modifications

Learning Goals

Students learn how to implement interpolation and trend estimation with real climate data. The implication of the trend estimation is the global rise in CO2, which could be used as a hook to relate it broader issues of climate change.

All of the analysis is conducted in MATLAB. The main purpose is for the students to develop data manipulation skills in that framework.

The activity includes data analysis and computation. In addition, students are encouraged to think of the consequences of their results.

Context for Use

This is an exercise designed for students who are learning how to program in MATLAB. These students could be at any level of their academic careers (undergraduate or graduate), but are likely to have limited experience of programming (I have mostly used it with graduate students). Students should have mastered basic syntax in MATLAB and had some experience of manipulating matrices and vectors, and the basics of graph plotting. Some basic linear algebra is assumed (matrix multiplication, transposition, inversion).

Description and Teaching Materials

Students download monthly CO2 data from the Mauna Loa Observatory archive ( They work on: (i) loading it into MATLAB; (ii) performing a quality control analysis of the data (and filling in any data gaps by interpolation); and (iii) estimating trends in the data and using them to make medium-term predictions.

A worked instructor answer set and example MATLAB script are provided.
Student handout for Keeling Curve activity (Microsoft Word 2007 (.docx) 41kB Oct22 16)
Worked instructor handout for Keeling Curve activity (Microsoft Word 2007 (.docx) 309kB Oct22 16)
Example MATLAB script used for the worked answers (Matlab File 6kB Oct22 16)

Teaching Notes and Tips


Worked examples are provided to check the students' answers against. The most effective method for assessing the students' MATLAB scripts I have found is to get them to talk me through what their code does, and how it does it - often there is more than one way to achieve the solution. This exercise would be better suited to formative, rather than summative, assessment.

References and Resources