I've just started a thesis on nonlinear dynamics which entails numerical analysis of the Duffing oscillator (DO). It's basically just a second order ODE, or equivalently a set of ODEs.
Say, after integration, I have data that looks like this:

I need to write an algorithm that 1) analyzes the data, 2) outputs the period of the DO for that particular set of parameters (after a certain but arbitrary(_ily adjusted) relaxation time). In the present case, the period is 4.
It would probably not be hard to write the algorithm if the DO behaved exactly the same way in each period, but it doesn't (necessarily, as I undersand it) - so the algorithm has to be somewhat 'fuzzy'.
Any ideas, links?
I'm using Python/MATLAB, but feel free to give a language-agnostic answer :)
Cheers!,
\T
in 