Advertisement
Guest User

Untitled

a guest
Sep 16th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. g = 9.81;
  2. a = 1.5;
  3. Subscript[w, 0] = Sqrt[g/a]
  4.  
  5. sol1 = NDSolve[
  6. {x1'[t] == x2[t],
  7. x2'[t] ==
  8. [Minus]1/2 x4'[t] Cos[x1[t] [Minus] x3[t]] [Minus]
  9. Subscript[w, 0] ^2 Sin[x1[t]] [Minus]
  10. x4[t] Sin[x1[t] [Minus] x3[t]],
  11. x3'[t] == x4[t],
  12. x4'[t] == [Minus]x2'[t] Cos[x1[t] [Minus] x3[t]] [Minus]
  13. Subscript[w, 0] ^2 Sin[x3[t]] + x2[t]^2 Sin[x1[t] [Minus] x3[t]],
  14. x1[0] == 0, x2[0] == 0, x3[0] == [Pi]/9, x4[0] == 0},
  15. {x1, x2, x3, x4}, {t, 0, 50},
  16. Method -> {"EquationSimplification" -> "Residual"}];
  17. x1sol[t_] := x1[t] /. sol1[[1]]
  18. x2sol[t_] := x2[t] /. sol1[[1]]
  19. x3sol[t_] := x3[t] /. sol1[[1]]
  20. x4sol[t_] := x4[t] /. sol1[[1]]
  21.  
  22. Plot[x1sol[t], {t, 0, 50}, Frame [RightArrow] True,
  23. PlotRange [RightArrow] {All, All},
  24. FrameLabel [Minus] > {StyleForm["time (s) ",
  25. FontSize [RightArrow] 14],
  26. StyleForm["[CurlyPhi]1 (rad)", FontSize [RightArrow] 14]}]
  27. Plot[x3sol[t], {t, 0, 50}, Frame [RightArrow] True,
  28. PlotRange [RightArrow] {All, All},
  29. FrameLabel [Minus] > {StyleForm["time (s) ",
  30. FontSize [RightArrow] 14],
  31. StyleForm["[CurlyPhi]2 (rad)", FontSize [RightArrow] 14]}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement