I am a seasoned Matlab programmer, yet I don't know how to solve this (seemingly) simple problem. I have a system of 5 equations and 5 unknowns:
I know how to solve ODEs using ode45 when there are no algebraic equations involved. In the system above, V (velocity) and C (acceleration) are both constant and known. C is the spacecraft transverse acceleration.
This problem should be solved as follows:
It's important to solve the problem using Matlab's ODE45, because it will eventually get pretty difficult to solve when I add wind, varying gravity and densities, the spacecraft mass and geometry (and inertias and so on!). So I will get a system of dozens of equations which will all be coupled. If I get to know how to solve this simple problem in Matlab, I will understand how to solve more complex ones in the future.
I've scavenged the internet in order to find some help, but it was in vain. Your help is very much appreciated.
With the corrected system you only have 3 state variables to integrate
function dotu = f(t,u)
theta = y(1);
dotu = [ C/V, -V*cos(theta), V*sin(theta) ];
end
and this you can then directly insert into the solver
[ T,U ] = ode45(f, [t0, tf], [ theta0, x0, y0])
using the appropriate values for the initial condition and the integration end.