Duffing and Van Der Pol oscillator examples.
Copyright 2012, Lance Larsen Licensed under the MIT license
Uses GMAmode.js, Animate.js, flot/jquery.js, and flot/jquery.flot.js
Examples | Duffing and Van Der Pol oscillator examples. |
Properties | |
colors | A set of colors used for plotting curves. |
colorSets | Different color sets. |
canvases | This is an object that is used to hold the list of current plot canvases. |
Functions | |
Ellipse | Get a parameteric function that produces the points for an ellipse. |
DuffingEqn | This generate a Duffing Equation ODE vector field function. |
DuffingSolver | Function to solve the Duffing equation. |
DuffingPlot | Plot the Duffing generalized 1-D mode and/or some of the solution curves. |
VanDerPolEqn | This generate a VanDer Pol Equation ODE vector field function. |
VanDerPolSolver | Function to solve the Duffing equation. |
VanDerPolPlot | Plot the VanDer Pol generalized 1-D mode and/or some of the solution curves. |
function Ellipse( a, excentricity, angle )
Get a parameteric function that produces the points for an ellipse. This is used to generate an initial modal curve in the region of an ODE is oscillatory and approximately linear.
a | the amplitude along the widest axis of the ellipse (the x axis). |
excentricity | The ratio of the small axis amplitude to the large axis amplitude. |
angle | The rotation angle of the ellipse from the x axis. |
A parametric function for an ellipse of the form func(t) which returns an [x,y] pt. The parameter t should go from 0 to 2*pi.
function DuffingEqn( eps, c )
This generate a Duffing Equation ODE vector field function. The duffing equation has the form x’’+2*c*x’+x+eps*x^3=0.
eps | The cubic nonlinearity coefficient |
c | The damping coefficient |
An Duffing ODE function of the form ‘V(t,pt)’ that returns the ODE vector [x’,x’’]. ‘t’ is the independent value, and ‘pt’ is [x,x’].
function DuffingSolver()
Function to solve the Duffing equation.
steps | The number of ODE steps to take when solving the Duffing equation. Note that this solves backwards from a solution near the equilibrium point with step sizes of -0.05. |
A GMAmode object for the Duffing oscillator.
function DuffingPlot( canvas, showMode, showSolns, animate )
Plot the Duffing generalized 1-D mode and/or some of the solution curves. The plot is animated, showing the time progress of the solution.
canvas | The canvas the the solution is plotted onto. |
showMode | Flag to indicate whether the modal contours should be plotted. |
showSolns | Flag to indicate whether the ODE solutions should be plotted. |
animate | Flag to show whether the plot should be animated. |
function VanDerPolEqn( c )
This generate a VanDer Pol Equation ODE vector field function. The Van Der Pol equation has the form x’’-c*(1-x^2)*x’+x=0.
c | The (negative) damping coefficient |
An Van Der Pol ODE function of the form ‘V(t,pt)’ that returns the ODE vector [x’,x’’]. ‘t’ is the independent value, and ‘pt’ is [x,x’].
function VanDerPolSolver()
Function to solve the Duffing equation.
isteps | The number of ODE steps to take solving the Van Der Pol equation from inside the limit cycle. The initial curve is an Ellipse near the unstable equilibrium. This solution is disabled at present. |
osteps | The number of ODE steps to take solveing the Van Der Pol equation from outside the limit cycle. The initial curve is a slightly expanded limit cycle curve. The solution is solved backwards (away from the limit cycle, with a step size of -0.05. |
A GMAmode object for the Van Der Pol oscillator.
function VanDerPolPlot( canvas, showModeIn, showModeOut, showSolnIn, showSolnOut, animate )
Plot the VanDer Pol generalized 1-D mode and/or some of the solution curves. The plot is animated, showing the time progress of the solution.
canvas | The canvas the the solution is plotted onto. |
showModeIn | Flag to indicate whether the modal contours inside the limit cycle should be plotted. |
showModeOut | Flag to indicate whether the modal contours outside the limit cycle should be plotted. |
showSolnIn | Flag to indicate whether the ODE solutions inside the limit cycle should be plotted. |
showSolnOut | Flag to indicate whether the ODE solutions outside the limit cycle should be plotted. |
animate | Flag to indicate whether the plot should be animated. |
Get a parameteric function that produces the points for an ellipse.
function Ellipse( a, excentricity, angle )
This generate a Duffing Equation ODE vector field function.
function DuffingEqn( eps, c )
Function to solve the Duffing equation.
function DuffingSolver()
Plot the Duffing generalized 1-D mode and/or some of the solution curves.
function DuffingPlot( canvas, showMode, showSolns, animate )
This generate a VanDer Pol Equation ODE vector field function.
function VanDerPolEqn( c )
Function to solve the Duffing equation.
function VanDerPolSolver()
Plot the VanDer Pol generalized 1-D mode and/or some of the solution curves.
function VanDerPolPlot( canvas, showModeIn, showModeOut, showSolnIn, showSolnOut, animate )