Uploaded by Ro se

hohmann

advertisement
There is one conceptual issue: you are not in the framework of Kepler's two-body problem.
You are in the framework of the restricted three body problem, and in fact, of a restricted
four body problem. You have Earth and an asteroid orbiting the sun and on top of that you
want a satellite to switch orbits from Earth to satellite. Are you trying to build just a toy
model, where everything orbits around the sun on circular orbits and you are switching from
– ?"Earth's" circular orbit to "asteroid's" circular orbit
Futurologist
Apr 26, 2021 at 18:54
I am neglecting the effect of the Sun and treating Earth as the centre of Hohmann Transfer so
Earth has coordindates [0 0 0]. My aim is to plot a spacecraft going from Earth to the altitude
of the asteroid, Ra = 7.431e7, via a Hohmann transfer. I have added more to my code but I
am still having issues plotting the orbit transfer. Also if possible how do you calculate the
– ?time of this hohmann transfer
SpaceGuy
Apr 26, 2021 at 20:54
Add a comment
Answer 1
:Sorted by
Highest score (default)
1
?Does this work for you
Function Numeric_Kepler
G = 6.674e-11/1e9; %gravitational constant
M_Earth = 5.972e24; %mass of Earth
Re = 6378; %radius of Earth (km)
;GM_Earth = G*M_Earth
Dt = 70; %time step In sec
Mu = 3.986e5; %gravitational parameter (km3/s2)
R1 = Re+500; %distance between initial position of spacecraft and Earth
Ra = 7.431e7; %distance of Bennu from Earth in (km) [August 2023]%
R_0 = [r1, 0, 0]; %Initial position of the spacecraft
V_0 = [0, sqrt(mu/r1), 0]; %initial uncorrected velocity of the spacecraft
Dv0 = [0, 1.3, 0]; %velocity correction
R0 = r_0; %Initial position of spacecraft
V0 = v_0 + dv0; %corrected initial velocity
initialization of the dynamical variables%
;R_ = r_0
;V_ = v_0
;R = r0
;V = v0
keepoint the plots in the same window%
Hold on
Grid on
setting up the window's shape by definig the coordinate axes' ranges %
;R2 = 3*r1
Axis([ -r2 r2 -r2 r2])
,generating the dynamics and potting It at the same time %
simple animation style %
Plot(0, 0, 'ro')
For j = 1:1000
propagation along spacraft's uncorrected orbit%
;[r_, v_] = Kepler_flow(r_, v_, dt)
Plot(r_(1), r_(2), 'bo')
propagation along spacraft's corrected orbit%
;[r, v] = Kepler_flow(r, v, dt)
Plot(r(1), r(2), 'ro')
Pause(0.1)
End
Function a = Gravity(x)
;A = - ( (GM_Earth) / norm(x)^3 ) * x
End
Function [r_1, v_1] = Kepler_step(r, v, dt)
;R_1 = r + (dt/2) * v
;V_1 = v + dt * Gravity(r_1)
;R_1 = r_1 + (dt/2) * v_1
End
Function [r_1, v_1] = Kepler_flow(r, v, dt)
;[r_1, v_1] = Kepler_step(r, v, dt/2)
;[r_1, v_1] = Kepler_step(r_1, v_1, dt)
;[r_1, v_1] = Kepler_step(r_1, v_1, dt/2)
End
Bi- elliptical:
Kerbal Space Program %
u/sto-ifics42/ %
02-09-2015 %
Plane Change Optimization %
-----%
Clc
Clear
Close all
Set initial constants %
;G=0.00000000006673
;Kerbin_R=600000
;Kerbin_M=5.2915793E+22
;Start_end_alt=100000
Calculate parameters for starting/ending circular orbit %
;Start_end_R=Kerbin_R+start_end_alt
;Start_end_V=sqrt((G*Kerbin_M)/start_end_R)
Create vectors describing transfer orbits %
;A_P_ratio=1:0.1:20
;A_R=A_P_ratio.*start_end_R
;Semimajor_axis=(A_R+start_end_R)/2
;P_V=sqrt(((2*G*Kerbin_M)/start_end_R)-((G*Kerbin_M)./semimajor_axis))
;A_V=sqrt(((2*G*Kerbin_M)./A_R)-((G*Kerbin_M)./semimajor_axis))
Generate matrix of dV as a function of plane change angle %
and transfer orbit apoapsis/periapsis radius ratio %
;'Degrees=(0:0.5:180)
;dV=((ones(361,1)*(2*(P_V-start_end_V)))+(sind(degrees/2)*2*A_V))/start_end_V
Find optimal transfer orbit for all plane change angles %
;[min_dV,best_A_P_ratio]=min(dV,[],2)
For i=1:1:length(best_A_P_ratio)
;Best_A_P_ratio(i)=A_P_ratio(best_A_P_ratio(I))
End
For i=2:1:length(best_A_P_ratio)
If best_A_P_ratio(I)==1 && best_A_P_ratio(I-1)==1
;Best_A_P_ratio(i-1)=NaN
End
If best_A_P_ratio(I)==20 && best_A_P_ratio(I-1)==20
;Best_A_P_ratio(i)=NaN
End
If best_A_P_ratio(I)==20 && isnan(best_A_P_ratio(I-1))
;Best_A_P_ratio(i)=NaN
End
End
Plot full dV matrix and optimal plane changes %
Figure
Contourf(A_P_ratio,degrees,dV,100,'LineColor','none')
Hold on
;Optimum=plot(best_A_P_ratio,degrees,'k','LineWidth',2)
Hold off
Add labels for axes %
Title('Plane Change \DeltaV as a Function of Plane Change Angle and Transfer Orbit
;Eccentricity','FontSize',20,'FontWeight','bold')
Xlabel('Transfer Orbit Apoapsis / Periapsis Ratio (Distance to Core)','FontSize',15)
Ylabel('Plane Change (\circ)','FontSize',15)
Xlim([1 20])
Ylim([0 180])
Legend(optimum,'Optimal Plane Change')
;C=colorbar
Ylabel(C,'Plane Change \DeltaV vs. Initial Orbital Velocity','FontSize',15)
Add notes for both extremes of optimal dV plot %
;[xmin,xmin_i]=min(best_A_P_ratio)
;Ymin=degrees(xmin_i+1)
;Note_min1=['Optimal plane changes below ',num2str(ymin),'\circ']
;Note_min2={note_min1,'do not require transfer orbits'}
Text(xmin+0.3,ymin,note_min2,'HorizontalAlignment','left','VerticalAlignment','top')
;[xmax,xmax_i]=max(best_A_P_ratio)
;Ymax=degrees(xmax_i-1)
;Note_max1=['Optimal plane changes above ',num2str(ymax),'\circ']
;Note_max2={note_max1,'require maximally eccentric transfer orbits'}
Text(xmax-0.3,ymax+5,note_max2,'HorizontalAlignment','right','VerticalAlignment','bottom')
Add nametag In case of repost %
Text(18,-10,'/u/sto-ifics42, 2015-09-02')
Download