How to plot conic from Lambert solver

I am trying to solve for an optimal multi-gravity assist trajectory from Earth to Saturn using Matlab. I have already solved for the departure and arrival velocities from and to each planet using a Lambert problem solver, and found the parameters of each gravity assist maneuver using a patched conic method. Therefore I am wondering how I can plot the conic trajectory for each leg (from planet 1 to planet 2)? What parameters from the Lambert solver would I need (the Lambert solver I am using returns the departure and arrival velocity, as well as the 2 extremal distances between the satellite and the Sun)? I tried integrating the equations of motion but I do not get a correct answer.

The equation of motion I used was

$$\frac{d^2 x}{dt^2} = -\mu \frac{x}{r^3} -\mu \frac{x_p}{r_p^3} - \mu_p \frac{x_{ps}} {r_{ps}^3}$$

where x is the heliocentric position, $$x_p$$ is the position of the Sun wrt the flyby planet, and $$x_ps$$ is the position of the satellite wrt the flyby planet. $$\mu$$ is the gravitational parameter of the Sun and $$mu_p$$ that of the flyby planet.

I used this equation for each leg of the trajectory (eg from Earth to Jupiter, the flyby planet will be Jupiter, and from Jupiter to Saturn, the flyby planet will be Saturn).

• When you integrated the equations of motion, did you make sure to only use the gravity of one body at at time, and "switch the source of gravity" from one body to the next at each patch-point? Also, your question might be easier to answer if you list all the "parameters from the Lambert solver" that are available from your solver.
– uhoh
Jul 23 '19 at 3:57
• The equation of motion I used was d^2x/dt^2=-mu*x/(r^3)-mu*xp/(rp^3)-mu_p*xps/(rps^3) where x is the heliocentric position, xp is the position of the Sun wrt the flyby planet, and xps is the position of the satellite wrt the flyby planet. mu is the gravitational parameter of the Sun and mu_p that of the flyby planet. I used this equation for each leg of the trajectory (eg from Earth to Jupiter, the flyby planet will be Jupiter, and from Jupiter to Saturn, the flyby planet will be Saturn).
– Lisa
Jul 23 '19 at 4:03
• I added your comment back into your question and used the MathJax formatting for the equation. Can you double check for any mistakes transcribing the equation? Feel free to edit further. Thanks! By the way, remember that in patched conics at any moment there is only one body that produces gravity. That's the nature of the patched conic approximation. When you have more than one source of gravity (as in the real world), the orbits can no longer be described by conic sections. When you fly past Jupiter, you have to "turn off" the Sun!
– uhoh
Jul 23 '19 at 4:11
• uhoh hit the nail on the head. Patched conics use the two body problem as an approximation. If you want to add perturbation terms, you will no longer have a conic section, but an osculating orbit which are keplerian in nature but will not follow the laws of conic sections since your orbital parameters will change over time. If you look at one time instance, you will be able to get a conic model. In theory you could dynamically solve for your conic at each time step but that seems a bit too complicated. Jul 30 '19 at 14:56