File Exchange

image thumbnail

Forced Duffing Oscillator

version (24.9 KB) by Housam Binous
Computes Poincaré section of the forced Duffing oscillator


Updated 16 Oct 2007

No License

The forced Duffing oscillator exhibits behavior ranging from limit cycles to chaos due to its nonlinear dynamics. When the periodic force that drives the system is large, chaotic behavior emerges and the phase space diagram is a strange attractor. In that case the behavior of the system is sensitive to the initial condition. In order to plot a Poincaré section, take one data point from phase space per period of the driving force. The Poincaré section is a complicated fractal curve when the phase diagram is a strange attractor. The Poincaré section is a single point when the phase space diagram is a limit cycle.

Here is a link to a Mathematica 6.0 Demonstration concerning the forced Duffing oscillator:

Cite As

Housam Binous (2021). Forced Duffing Oscillator (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (18)

lal said


How can I plot Amplitude vs Frequency with this code?

Thank you

Matteo Broggi

Global variables should be avoided. ALWAYS!
Just change the header of duffing.m to

and call ODE45 with an anonymous function

duf = @(t,x) duffing(t,x,gamma,omega,epsilon,GAM,OMEG);
[t x]=ode45(duf,0:2*pi/OMEG/100:400,[0 1]);


Merci pour les codes..
Toujours utiles...

Shima Khatiri

Alberto Manzanero

How can I plot Amplitude vs Frequency with this code?

Thank you

Thank you, Binous. helped me a lot.

farideh mhassani

Akash kumar

Why this code is not running ?
there is some problem which says ''Error using feval
Undefined function 'duffing' for input arguments of type 'double''.What should I do,any help will be appeciated.

Woo Sang Pyo

thank you for your efforts
I have a question
in your m-file xdot=duffing(t,x), why omega^2*x(2) term is plus sign not negative sign?

Woo Sang Pyo

sabara thinam

i'm very happy to using this programme it's very nice

sabara thinam

mr.housam binous done a wonderfull making of duffing forced oscillator.. i'm using this in this programme is very usfull my studies...

thank you for the source codes;
they are really helpful;

Przemyslaw Jasinski

very good, helped me a lot.

Nicholas Fantuzzi

The m-file doesn't work with epsilon < 0


very helpful and easy to understand

MATLAB Release Compatibility
Created with R14SP1
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!