Slexy.org is shutting down and stopped accepting new Pastes on May 4th, 2021.
Existing Pastes will stop being available on or after May 10th, 2021.
Author: Not specified Language: text
Description: Not specified Timestamp: 2017-09-19 11:35:10 +0000
View raw paste Reply
  1.  
  2. w = 3; xo = 1; po = 0; T = 10;
  3.   sol = NDSolve[{Derivative[1][x][t] ==
  4.       p[t], x[0] == xo,
  5.      Derivative[1][p][t] == (-w^2)*x[t],
  6.      p[0] == po}, {x, p}, {t, 0, T}];
  7.   graph1 = Plot[Evaluate[{x[t], p[t]} /.
  8.       sol], {t, 0, T}];
  9. graph2 = ParametricPlot[Evaluate[
  10.      {x[t], p[t]} /. sol], {t, 0, T}];
  11. Show[GraphicsArray[{graph1, graph2}]]
View raw paste Reply