ed84c Posted September 30, 2009 Posted September 30, 2009 I'm trying to write a Matlab (well.. octave) code to plot the tradjectory of a satellite in orbit. Unfortunately it just keeps drawing a diagonal line, but I can't for the life of me work out why it wont do any type of "proper" orbit. I think it's nearly there as if I "drop" the satelite (no tangental velocity) it does a sort of 1D elipse. I've attatched the file anyway (renamed .m to .txt as uploader didn't like) if somebody could have a look I would be very appreciative. I'm using the following to work out trajectories (given in question); [Math] r(t + \delta t) = 2r(t) - r(t-\delta t) + \delta t^2 * F(t)/m...............and....... \\ \\ v = 1/(2 \delta t)*x(t+\delta t) - x(t-\delta t)) [/Math] F, r, and v are 3D vectors for the Force, posion and velocity respectively. I'm plotting the x and z values of r(x,y,z)- to try and generate a loop, elipse etc of a 2D orbit. Orbit2.txt
ed84c Posted October 1, 2009 Author Posted October 1, 2009 OK turns out it is working... sort of. My point was being sucked into the black hole and then the programme got upset and decided to spit it out creating a massive line that dwarfed the orbit before being "sucked in". However- the orbits still seem a little odd though- the origin of the black hole (0,0) is far too close to the elipse IMO. If somebody could take a look it'd be really good. I've attatched some pics and the altered code for a reasonable orbit. If you want to change the "starting velocties" change r and/ or rOld, in units of about 100- there is not explicit starting velocity that changes the tradjectory (it is effectively (r-rOld)/dt). You can increase the "length" of the orbit it is showing by changing t. Orbit2 (2).txt
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now