I'm trying to write a script for a 'shape based' trajectory, based on the exponential sinusoid shape, for an Earth - Mars transfer. Essentially, I know where I want to start, and I know where I want to end, and I know how much time I want to take. I have the script that can generate my trajectory, for user specified shaping parameters (k1 and k2) and revolutions around the sun (N). What I would like to do is basically the reverse, for a known start point A, and a known end point B, with a given TOF(which is usually determined after the shape trajectory is drawn), find the optimal shaping parameters k1,k2 and revolutions N.

I basically want the 'optimum' k1, k2 and N for a given three year trajectory. Some of the code is provided below; I don't know how to include MATLAB script.

r = k0*exp((k1*sin(k2*th+phi))); - this equation is the equation of the eponential sinusoid. It goes into a for loop and spits out a vector of radii that can be plotted until the end point.

k0 = r1/exp(k1*sin(phi)); k0 is merely a scalar factor, with r1 being start point. Phi is a constant and is always pi/2

k1 = sqrt( ( (log(r1/r2) + sin(k2*th_f)*tan(g_i)/k2) / (1-cos(k2*th_f)) )^2 + tan(g_i)^2/k2^2 ); - r2 is the end point, th_f is the final polar angle in polar co-ordinates, g_i is set to 0 for this problem and k2 is user specified (usually about 1/12)

th_f = psi + 2*pi*N; - psi is the final angle you want to make with your start point (pi/2 in this case) and N is the number of whole revolutions around the sun.

Apologies for the lengthy question; for thoroughness k1 is apoapsis to periapsis radius, and k2 is a winding parameter, tells you how windy your spiral is.

EDIT I think, with thanks to Tristan, I can find a way of expressing the equation for TOF in terms of N, k2, k1, and create a function that way where the it would like f(x) = TOF(k2,N,k1) -3 years and use the genetic algorithm to optimise f(x) that way. Will post results soon!

  • $\begingroup$ This isn't a space exploration problem, an optimization problem, or even a MATLAB problem so much as it is simply a multivariate root finding problem. Let go of the MATLAB portion and concentrate on the mathematics first. Much of your equation nastiness cancels out with your choice of constants. I don't see, however, where the time of flight fits into this system of equations (except as some unspecified function of th_f). $\endgroup$ – Tristan May 15 '18 at 15:06
  • $\begingroup$ @Tristan when you say "Much of your equation nastiness cancels out with your choice of constants" what precisely do you mean by that? Uhhh yeah I forgot to mention that. TOF arises as an integration of 1/theta_dot*dtheta from th_0 to th_f. th_0 is set to 0 for this problem, and theta_dot has it's own expression given below. theta_dot = sqrt( mu/r^3 * 1/(tan(gamma)^2 + k1*k2^2*sin(k2*th+phi) +1) ); - where all symbols are as given in the original question, and gamma is given below gamma = atan(k1*k2*cos(k2*th+phi)); $\endgroup$ – Harvey Rael May 15 '18 at 15:23
  • $\begingroup$ Multivariable mathematics aren't something I am particularly good at. I'm not sure what I even supposedly minimise because I'm setting my threshold for TOF, and minimising my trajectory radius doesn't exactly make sense to me? And, as can be seen k1 and k2 are linked, so I'm not sure how to find the "best" pair (or trio if you include N) of values that meet my criteria. $\endgroup$ – Harvey Rael May 15 '18 at 15:26
  • $\begingroup$ Some examples of equation nastiness that can be simplified: if phi is always pi/2, then sin(phi) is 1. If g_i is 0, then tan(g_i) is also 0. That eliminates a number of terms in these equations and makes it much easier to work with. $\endgroup$ – Tristan May 15 '18 at 19:38
  • $\begingroup$ Ok, but I guess I don't understand how to optimise anything.. I understand how setting the TOF makes it essentially a root finding exercise, but surely the set of answers is an infinite set of numbers? $\endgroup$ – Harvey Rael May 16 '18 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.