Duffing Oscillator Phase Space Animator

This MATLAB code provides an elegant visualization of the Duffing oscillator's phase space dynamics.
8 Downloads
Updated 27 Oct 2024

View License

This MATLAB code provides an elegant visualization of the Duffing oscillator's phase space dynamics, specifically demonstrating the system's sensitivity to initial conditions. The implementation features a sophisticated animation of two nearby trajectories, highlighted through an aesthetically pleasing dark-themed interface.
Key Features
  • Interactive visualization of the Duffing oscillator's phase space
  • Simultaneous animation of two trajectories with nearby initial conditions (0.5 and 0.51)
  • Clear visual distinction between trajectories using contrasting colors
Technical Details
  • System Parameters:
  • Damping coefficient (γ) = 0.1
  • Linear stiffness (α) = -1
  • Non-linear stiffness (β) = 1
  • External force amplitude (F) = 2
  • Forcing frequency (ω) = 2.4
Requirements
  • MATLAB R2019b or newer
  • Video Writer support for MP4 format
Usage
  1. Simply run the script to generate the animation
  2. The animation will be automatically saved as 'duffing_animation.mp4'
  3. Parameters can be easily modified at the beginning of the script
Customization Options
  • Adjust trail_length for different trajectory history lengths
  • Modify step variable to change animation speed
  • Color schemes can be customized through the animation parameters
  • Video quality and frame rate are adjustable via VideoWriter properties
Applications
  • Educational demonstrations of chaos theory
  • Research in nonlinear dynamics
  • Teaching material for physics and mathematics courses
  • Visualization of sensitive dependence on initial conditions
Author Notes
This implementation focuses on visualizing the butterfly effect in the Duffing oscillator by tracking two nearly identical initial conditions. The dark theme and color choices are optimized for clarity and visual appeal, making it ideal for both educational and research purposes.

Cite As

Sathyanarayan Rao (2024). Duffing Oscillator Phase Space Animator (https://www.mathworks.com/matlabcentral/fileexchange/174490-duffing-oscillator-phase-space-animator), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2024a
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!
Version Published Release Notes
1.0.0