New in Wolfram Mathematica 7: Delay Differential Equations  previous | next 
Study Control of an Inverted Pendulum
This compares a simple control for an inverted pendulum where the control does and does not have a delay.
In[1]:=

Click for copyable input
nodelay[d_] := 

  First[NDSolve[{x''[t] + d x'[t] + Sin[x[t]] == -x[t] Cos[x[t]], 

     x'[0] == 0, x[0] == .1}, x, {t, 0, 50}]];
In[2]:=

Click for copyable input
withdelay[\[Tau]_, d_] := 

 First[NDSolve[{x''[t] + d x'[t] + 

      Sin[x[t]] == -x[t - \[Tau]] Cos[x[t]], x[t /; t <= 0] == .1}, 

   x, {t, 0, 50}]]
In[3]:=

Click for copyable input
Grid[Table[

  Plot[Evaluate[{x[t] /. {nodelay[d], withdelay[\[Tau], d]}}], {t, 0, 

    50}, AspectRatio -> 1, PlotRange -> All, 

   Frame -> True], {\[Tau], {.2, .3}}, {d, {0.01, 0.02, 0.03}}]]
Out[3]=