Mathematica: NDSolve in 3 dimensions

  • Mathematica
  • Thread starter Niles
  • Start date
  • #1
1,868
0
Hi

I am trying to solve Newtons equation for a particle in (x, y, z) using NDsolve. Here I what I have so far:

Code:
sol = NDSolve[{
    x''[t] == acceleration[x'[t], y[t], z[t]],
    y''[t] == acceleration[y'[t], x[t], z[t]],
    z''[t] == 0,
    x[0] == 2, x'[0] == 0, y[0] == 0, y'[0] == 0, z[0] == 0, 
    z'[0] == 250},
   {x[t], y[t], z[t]}, {t, 0, 1}];

ParametricPlot[{x[t], x'[t]} /. sol, {t, 0, 0.001}, PlotRange -> {{0, 0.35}, {0, 5}}, AspectRatio -> 0.75]
The force acting on the particle only affects (x, y), not z. However, my plot is empty.

Is my use of NDsolve correct?

Best,
Niles.
 

Answers and Replies

  • #2
1,868
0
I found one error. It should be {x, y, z}, not {x[t], y[t], z[t]}. However, the parametric plot still doesn't work.
 
  • #3
1,868
0
It works now, there was a problem with my IV. Just had to pick a correct value.

Best,
Niles.
 

Related Threads on Mathematica: NDSolve in 3 dimensions

  • Last Post
Replies
3
Views
2K
Replies
3
Views
1K
Replies
2
Views
2K
  • Last Post
Replies
1
Views
7K
Replies
6
Views
2K
Replies
5
Views
3K
Replies
3
Views
4K
Replies
8
Views
8K
Replies
6
Views
1K
Replies
4
Views
5K
Top