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

조회 수: 7 (최근 30일)
Oskar Kinat
Oskar Kinat 2022년 9월 26일
편집: James Tursa 2022년 9월 27일
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
Steven Lord
Steven Lord 2022년 9월 26일
You should ask whomever gave you this assignment (your professor or teaching assistant, I assume?) for more information.
Oskar Kinat
Oskar Kinat 2022년 9월 27일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

James Tursa
James Tursa 2022년 9월 27일
편집: James Tursa 2022년 9월 27일
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
Oskar Kinat
Oskar Kinat 2022년 9월 27일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by