Change of position of velocity vectors and time interval between the change

8 visualizaciones (últimos 30 días)
How would I symbolically write a MATLAB code that can find:
a) Position and Velocity vectors at a later time given initial position and velocity
b) The interval (time) between the initial and final values
  4 comentarios
Steven Lord
Steven Lord el 26 de Sept. de 2022
You should ask whomever gave you this assignment (your professor or teaching assistant, I assume?) for more information.
Oskar Kinat
Oskar Kinat el 27 de Sept. de 2022
You were right. He provided more information today. He gave the initial position,velocity, and what I should get for the final if I I find a way to solve it in MATLAB.

Iniciar sesión para comentar.

Respuestas (1)

James Tursa
James Tursa el 27 de Sept. de 2022
Editada: James Tursa el 27 de Sept. de 2022
Looks like an orbit problem. Around the Earth, I presume? You will not be using the Symbolic Toolbox for this assignment. You will be doing numerical integration. You need to do the following:
  • Write down the differential equations of motion (should be a 2nd order 3-element vector differential equation)
  • Convert this to a set of six 1st order differential equations (see ode45( ) doc for example of this)
  • Write a derivative function that takes (t,y) as input (t=time,y=6-element state vector) and outputs 6-element derivative vector)
  • Pass derivative function handle, time span, and initial conditions to ode45( )
  • Compare end result with expected result
The 2nd order 3-element vector differential equation should look like = some function of and μ
The 6-element state vector to use would be [] (i.e., stack position and velocity [] ).
The derivative of this 6-element state vector is simply [], or [].
In fact, the derivative function is pretty simple and would look something like this:
function ydot = orbit_derivative(t,y)
mu = appropriate value for the planet (units need to be consistent with t and y)
r = y(1:3); % the 3-element position vector
rdot = y(4:6); % the 3-element velocity vector
rdotdot = your expression for the 2nd derivative in terms of r and mu (you fill this in)
ydot = [rdot;rdotdot]; % the 6-element derivative vector to return
end
The function handle you would pass to ode45( ) would be @orbit_derivative
Alternatively you could pass in mu as an extra argument to the derivative function, in which case the function handle you would pass to ode45( ) would be @(t,y)orbit_derivative(t,y,mu)
For the true anomaly part of this assignment, you will need code that can calculate classical orbital elements from a state vector.
Make an effort at this, and post specific questions about your code if you run into problems. The above assumes you can use the MATLAB supplied numerical integration functions such as ode45( ). If that is not the case, then you will need to write your own solver using a method such as Euler, Modified Euler, or RK4. But in either case, you would still use the exact same derivative function outlined above.
  1 comentario
Oskar Kinat
Oskar Kinat el 27 de Sept. de 2022
You know it! Definitely an orbit problem.....
Thank you so much for your tips. I just watched a quick youtube video about the ode45() function. I will give it a try and see how far I get.

Iniciar sesión para comentar.

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by