The phase oscillator
The mathematical core of a CPG is simpler than the biology suggests. Start with the simplest possible oscillator.
Represent one rhythmic unit by a single variable, its phase , a number that advances continuously and wraps around at . Its dynamics are one equation:
The phase advances at constant rate , the intrinsic frequency. Output any periodic function of the phase, typically a sinusoid, and you have a rhythm.
The reason to work with phase rather than the output signal directly is that phase makes relationships between oscillators expressible. Two oscillators are in step if their phases match, in antiphase if they differ by , and locomotion is largely about maintaining such relationships.
A phase alone has no amplitude, so practical CPGs use an amplitude-phase formulation, adding a second variable r whose dynamics converge to a target amplitude. That gives independent control of how fast the rhythm runs and how large the resulting motion is, which maps directly onto frequency and stride length.
Everything that follows is built from coupling these units together.

