AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
![]() set_aspect ( "equal" )įunction lagrange_points_example % These masses represent the Earth-Moon system m1 = 5.974E24 % kg m2 = 7.348E22 % kg pi2 = m2 / ( m1 + m2 ) function y = collinear_lagrange (xstar ) firstterm = xstar secondterm = ( 1 - pi2 ). plot ( 0, 0, 'k', marker = center_of_mass, markersize = 10 ) ax. plot (,, 'k', ls = "-", lw = 1 ) # Plot the Lagrange Points and masses ax. set_ylabel ( "$y^*$" ) # Plot the orbits ax. subplots ( figsize = ( 5, 5 ), dpi = 96 ) ax. Python is flexible enough to allow us to define pi_2 as another parameter.įig, ax = plt. Like for the solve_ivp function, we need to define a function that returns a value given the single input xstar. Python #įirst, we will demonstrate the Python solver. Thus, if the root is below your initial guess the MATLAB solver will not be able to find it. MATLAB ( fzero): Either or depending on the value of \(\pi_2\)įor some reason, the fzero() in MATLAB seems much more sensitive to the initial guess value, and if you only provide a single value for the initial guess, it chooses a positive value as the second part of the interval. My suggestion is to use the following initial guess range for both functions, depending on which Lagrange point you’re looking for: 15, we can determine the range of \(x^*\) values associated with each point.īoth and fzero depend on having a good initial guess to get to the right Lagrange point. Here, we have a function \(f(x^*, \pi_2)\), which for a given value of \(\pi_2\) has three roots for \(x^*\), one for each of the collinear Lagrange points.
0 Comments
Read More
Leave a Reply. |