Virtual Pendulum Experiments & Mechanical Oscillations

Jeremy A Riousset, Florida Institute of Technology-Melbourne, APSS

Author Profile


The pendulum motion is one of the first encounters with the concept of a harmonic oscillator. This activity seeks to complement a traditional, rigorous, theoretical approach with a rigorous numerical model. It employs MATLAB to visualize how the characteristics of the pendulum and its environment change the motion in the animated figures.

The assignment comprises five (5) problems assigned to honors freshmen students in physics and space science majors. They use a provided MATLAB Live Script and focus on the following physics concepts: forces, friction, drag, gravity, energy conservation, rotational motion, periodic motion, pendulum, and oscillations.

Used this activity? Share your experiences and modifications

Learning Goals

The virtual pendulum experiment is a stepping stone to numerous physics problems (see Teaching Notes and Tips).

A. Technical skills:

In this particular activity, the students will:

  1. learn about numerical solution of ordinary differential equations (ODEs);
  2. discover how the Runge-Kutta solver solves both linear and non-linear ODEs;
  3. use MATLAB to apply computational methods in the context of a familiar experiment;
  4. measure a periodic motion (period, frequency, angular frequency, amplitude);
  5. explore the limits of the small-angle approximation;
  6. investigate the differences between laminar drag (i.e., Stoke's friction) and turbulent drag;
  7. study dampened oscillations.

B. Analytical skills

The students will deepen their understanding of oscillatory motions. They will:

  1. explore inaccessible environments (e.g., experiments on Mars or the Moon).
  2. appreciate the benefits of numerical tools, particularly well adapted for remote learning.
  3. appraise various effects (gravity, the mass of the pendulum, the length of the string) on the frequency of the oscillatory motion.

C. Writing skills

In their final report, they will learn the rules of scientific literature, and specifically how to:

  1. formulate a scientific question;
  2. write an abstract;
  3. structure an article;
  4. produce figures with labels and captions;
  5. reference the peer-reviewed literature.

Context for Use

The MATLAB problems focus on pendulum motion and mechanical oscillations typically covered in a freshman physics course. One problem is assigned every other week during the semester. The assignment comprises a mix of pencil and paper theory problems with numerical experiments. It provides students with the opportunity to develop their computational skills to program a MATLAB function and confront their analytical calculations to the outcome of the numerical experiments. The assignment provides the students with an instruction sheet as well as a Live Script named PHY1001_Pendulum.mlx. It does not require prior knowledge of MATLAB other than how to run a Live Script.

Description and Teaching Materials

The activity uses:

  • An animated model of pendulum oscillations;
  • Student Instructions for Pendulum Experiment Project (Microsoft Word 2007 (.docx) 831kB Oct26 21): an instruction sheet, which provides the problems' statements;
  • Student Live Script Template for Pendulum Experiment Project (MATLAB Live Script 90kB Oct20 21): a MATLAB Live Script called PHY1001_Pendulum.mlx to serve as a basis for the numerical experiments.
    The student will write their own function f = Stokes(pdl,w,env) to model Stoke's drag using the example of function D = drag(pdl,w,env).
    The student will change the variables to adapt the conditions to the given problem, record the outcome of the experiments, and interpret the results. At the end of the semester, they will write a report following the typical requirements of a scientific article.

Teaching Notes and Tips

The assignment encompasses many topics typically taught in freshman physics courses for engineering and science majors. The project accompanies the instruction throughout a 16-week semester. However, some instructors may prefer to assign the problems weekly during the second half of the semester, after the instructor has covered most of the topics.

In this activity, the students can reflect on the following topics:

  • What other oscillations are they familiar with?
    • Mechanical: spring-mass system, acoustic waves, marble-slope system.
    • Electronics: LC circuit, LCR circuit.
    • Electromagnetic waves: light, particles in field.
    • Quantum mechanics: eigenstates.
  • What are eigenvectors and eigenvalues for a harmonic oscillator?
  • What is damping the oscillation of a pendulum? Is there an equivalent in other oscillators?
  • What changes when oscillations are breaking the small-angle approximation?
  • What does linearity mean for a differential equation? How to observe it in a phase diagram?


The students are evaluated based on the rubrics provided in the instruction sheet. Specifically, the project tests the students' ability to:

  • execute a MATLAB Live Script (A.1, A.2, A.3)
  • run a virtual pendulum experiment (A.4, B.2, B.3)
  • modify a Live Script to change the initial conditions (A.5, A.7, B.1, B.2, B.3);
  • write a simple function (A.3, A.6, A.7, B.2, B.3);
  • report their findings in a scientific format (C.1, C.2, C.3, C.4, C.5).

* We provide the relevant learning objectives in parentheses.

References and Resources

Student handouts

  • An instruction sheet (Word or pdf).
  • A Live Script.

Answer key

  • A step-by-step answer to each question in the form of a pdf.
  • A Live Script with an example of implementation of the function f = Stokes(pdl,w,env).


Runge-Kutta methods:

Pendulum equation:

  • Young, H. D. & Freedman, R. A. (2020) University Physics with Modern Physics, 15th Ed, Ch. 14, Pearson, Hoboken, NJ, ISBN-13: 978-0-1351-5955-2.
  • Hyperphysics:


  • Curtis, H. (2020) Orbital Mechanics for Engineering Students, 4th Ed., Ch. 10, Butterworth-Heinemann, Amsterdam, NE.