movements of the descent vehicle in the atmosphere of Earth

조회 수: 2 (최근 30일)
danny crizalid
danny crizalid 2020년 5월 22일
댓글: James Tursa 2020년 5월 27일
I need help writting a Matlab script file, In the matlab I need to write the equations of motion of the space capsule that are as follows:
and I need the graph of time (x axis) vs speed (y axis).
  댓글 수: 3
Ameer Hamza
Ameer Hamza 2020년 5월 22일
편집: Ameer Hamza 2020년 5월 22일
Is it necessary to write your own RK-4 code, or can you use ode45?
danny crizalid
danny crizalid 2020년 5월 22일
is indifferent, but I want to do it for RK4 code

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

채택된 답변

James Tursa
James Tursa 2020년 5월 22일
You have four differential equations involving four variables: V, theta, H, and L. You have to solve these simultaneously since they depend on each other. You can't just pick the one you want and try to solve it by itself like this:
f = @(t,v) v*sind(theta);
You need an f that takes in a 4-element state vector containing V, theta, H, and L, and produces a 4-element derivative vector containing dV/dt, dtheta/dt, dH/dt, and dL/dt. Then that is used in your RK4 looping code.
  댓글 수: 15
James Tursa
James Tursa 2020년 5월 26일
Please show us your current code. You should have two separate files. One script file that sets constants and executes the RK4 code, and another derivative function file.
Also, I did not notice the large stepsize z that you have. That simply won't work. You need the t vector to have a much smaller stepsize. E.g.,
z = 0.5;
t = 0:z:900;
And H should not be a vector that you initialize. H should just be a single scalar number that is the initial value. Your RK4 code will be calculating the other H values dynamically as part of the simulation. E.g.,
H = 100000; % initial height (m)
James Tursa
James Tursa 2020년 5월 27일
You are going to get garbage out if you continue to use a huge stepsize. You need to drop the stepsize as I suggested. E.g.,
z = 0.5;
t = 0:z:900;

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by