Harmonic Oscillator Explorer

Illustrates a suite of symbolic solutions for a forced damped harmonic oscillator and parameter extraction in the presence of transients.
40 Downloads
Updated 22 Jan 2023

View License

This script derives and illustrates symbolic solutions to the equation of motion for a forced damped harmonic oscillator using MATLAB symbolic tools. Harmonic, step, ramp, and impulse forcing functions are considered and the impulse response used as a Green's function to rederive the step function response.
The full solution to the harmonically driven damped harmonic oscillator exhibits an interesting beat phenomenon often observed but ignored in laboratory experiments with driven mechanical and electrical oscillators in introductory courses. Given the full analytic solution, one can use nonlinear regression to determine the initial conditions and system parameters from any combination of transient and steady-state behavior. This is illustrated by fitting simulated data in which the beats are evident as generally occurs when scanning the drive frequency over a resonance.
The response of a harmonic oscillator to a general prescribed external force is a topic of an intermediate university-level mechanics course. This script may interest university students and instructors in physics and engineering. 'Try this' suggestions are included for further exploration.

Cite As

Duncan Carlsmith (2024). Harmonic Oscillator Explorer (https://www.mathworks.com/matlabcentral/fileexchange/123715-harmonic-oscillator-explorer), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2022b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

HarmonicOscillatorExplorer

Version Published Release Notes
1.0.0