Duffing Forced Damped Harmonic Oscillator
Clear[x]
duffing = x''[t] + 2*g*x'[t] + x[t] + x[t]^3 - f*Cos[w*t]
3
-(f Cos[t w]) + x[t] + x[t] + 2 g x'[t] + x''[t]
ans = NDSolve[{duffing ==0/.{g->1/10,f->20,w->1.45},x[0]==0,x'[0]==4},x,{t,0,200},MaxSteps->3000]
NDSolve::mxst: Maximum number of 3000 steps reached at the point t == 82.0993.
{{x -> InterpolatingFunction[{{0., 82.0993}}, <>]}}
Plot[x[t]/.ans,{t,0,60}];
![[Graphics:Duffinggr2.gif]](Duffinggr2.gif)
x = x[t]/.ans
v = D[x[t]/.ans, t]
{InterpolatingFunction[{{0., 82.0993}}, <>][t]}
{InterpolatingFunction[{{0., 82.0993}}, <>][t]}
Plot[x,{t,0,60}];
![[Graphics:Duffinggr2.gif]](Duffinggr2.gif)
Plot[v,{t,0,60}];
![[Graphics:Duffinggr2.gif]](Duffinggr2.gif)
ParametricPlot[{x[[1]],v[[1]]}, {t,0,60}];
![[Graphics:Duffinggr2.gif]](Duffinggr2.gif)