- #1
Henriklm
- 8
- 0
"for" loops problem
I would like Mathcad 2001i to calculate a trajectory for me.
The idea is to take initiating x,y coordinates and x,y velocity, calculate the x,y acceleration at that point and then calculate where it will be after 1 t, then calculate the new acceleration and velocity for the new position and so on.
mmåne = mass of moon
xmåne = x position of moon
ymåne = y position of moon
vx0 and vy0 = initiating velocities
v = angle to x-axis
accx = G*(mmåne / distance to moon^2) * cos(v)
accy = G*(mmåne / distance to moon^2) * sin(v)
I tried this
http://img404.imageshack.us/img404/4377/forloop.jpg" [Broken]
But it doesn't work like i want it to.
I think it takes the initiating coordinates and just multiply the acceleration at that point by t.
Which gives me this trajectory:
http://img138.imageshack.us/img138/1750/trajectory.jpg [Broken]
The green dots are plotted in the same time interval, so I can se, that it still accelerates after it passes the moon. Like it would, if it takes the initiating coordinates and just multiply the acceleration at that point by t.
Thank you :-)
Henrik
Homework Statement
I would like Mathcad 2001i to calculate a trajectory for me.
The idea is to take initiating x,y coordinates and x,y velocity, calculate the x,y acceleration at that point and then calculate where it will be after 1 t, then calculate the new acceleration and velocity for the new position and so on.
mmåne = mass of moon
xmåne = x position of moon
ymåne = y position of moon
vx0 and vy0 = initiating velocities
v = angle to x-axis
Homework Equations
accx = G*(mmåne / distance to moon^2) * cos(v)
accy = G*(mmåne / distance to moon^2) * sin(v)
The Attempt at a Solution
I tried this
http://img404.imageshack.us/img404/4377/forloop.jpg" [Broken]
But it doesn't work like i want it to.
I think it takes the initiating coordinates and just multiply the acceleration at that point by t.
Which gives me this trajectory:
http://img138.imageshack.us/img138/1750/trajectory.jpg [Broken]
The green dots are plotted in the same time interval, so I can se, that it still accelerates after it passes the moon. Like it would, if it takes the initiating coordinates and just multiply the acceleration at that point by t.
Thank you :-)
Henrik
Last edited by a moderator: