# Phase Plane (Second Order Equation)

Let's plot the phase plane of the Duffing Oscillator y''=-y^3 + y.First we need to convert this second order equation to a first r`order system. Here is how that is done Define z(t) to be the velocity, that is, z = y'. Then z' = y''. But we know what y'' is from the second order equation. So z' = -y^3 + y. Hence, the Duffing Oscillator is equivalent to the system y' = z, z' = - y^3 + y. The phase plane of the Duffing Oscillator is the graph of (y(t), z(t)) for various initial conditions. We use NDSolve to solve the system and plot the trajectories, as follows:

tfinal = 3;

data={{1,1}, {1, -1}, {2,2}, {3,4}};

eqns={y'[t]== z[t], z'[t]==-(y[t])^3+y[t]};

(* *)

sol = Table[NDSolve[Flatten[{eqns,

y[0] == data[[i,1]],

z[0] == data[[i,2]]}],

{y, z}, {t, 0, tfinal}],

{i, 1, Length[data]}];

soll1 = Flatten[sol, 1];

output1 = ParametricPlot[Evaluate[{z[t], y[t]} /. soll1], {t, 0, tfinal},

DisplayFunction->Identity];

OutPut = Show[output1,DisplayFunction->$DisplayFunction];

The output is