Skip to content

Commit 7a3328a

Browse files
committed
foo
1 parent 94d2f33 commit 7a3328a

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

docs/src/application-orbit.md

+25-26
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ p0 = p0 / norm(p0) # Normalization |p0|=1 for free final time
171171
jshoot(ξ) = ForwardDiff.jacobian(shoot, ξ)
172172
shoot!(s, ξ) = (s[:] = shoot(ξ); nothing)
173173
jshoot!(js, ξ) = (js[:] = jshoot(ξ); nothing)
174-
#bvp_sol = fsolve(shoot!, jshoot!, ξ; show_trace=true); println(bvp_sol)
174+
bvp_sol = fsolve(shoot!, jshoot!, ξ; show_trace=true); println(bvp_sol)
175175
nothing # hide
176176
```
177177

@@ -199,37 +199,36 @@ tf = 1.210e3; p0 =-[-2.215319700438820e+01, -4.347109477345140e+01, 9.6131888072
199199
p0 = p0 / norm(p0) # Normalization |p0|=1 for free final time
200200
ξ = [tf; p0]; # Initial guess
201201
202-
#bvp_sol = fsolve(shoot!, jshoot!, ξ; show_trace=true); println(bvp_sol)
202+
bvp_sol = fsolve(shoot!, jshoot!, ξ; show_trace=true); println(bvp_sol)
203203
nothing # hide
204204
```
205205

206206
## Plots
207207

208208
```@example main
209-
# tf = bvp_sol.x[1]
210-
# p0 = bvp_sol.x[2:end]
211-
# ode_sol = fr((0, tf), x0, p0)
212-
# t = ode_sol.t; N = size(t, 1)
213-
# P = ode_sol[1, :]
214-
# ex = ode_sol[2, :]
215-
# ey = ode_sol[3, :]
216-
# hx = ode_sol[4, :]
217-
# hy = ode_sol[5, :]
218-
# L = ode_sol[6, :]
219-
# cL = cos.(L)
220-
# sL = sin.(L)
221-
# w = @. 1 + ex * cL + ey * sL
222-
# Z = @. hx * sL - hy * cL
223-
# C = @. 1 + hx^2 + hy^2
224-
# q1 = @. P *((1 + hx^2 - hy^2) * cL + 2 * hx * hy * sL) / (C * w)
225-
# q2 = @. P *((1 - hx^2 + hy^2) * sL + 2 * hx * hy * cL) / (C * w)
226-
# q3 = @. 2 * P * Z / (C * w)
227-
228-
# plt1 = plot3d(1; xlim = (-60, 60), ylim = (-60, 60), zlim = (-5, 5), title = "Orbit transfer", legend=false)
229-
# @gif for i = 1:N
230-
# push!(plt1, q1[i], q2[i], q3[i])
231-
# end every N ÷ min(N, 100)
232-
nothing
209+
tf = bvp_sol.x[1]
210+
p0 = bvp_sol.x[2:end]
211+
ode_sol = fr((0, tf), x0, p0)
212+
t = ode_sol.t; N = size(t, 1)
213+
P = ode_sol[1, :]
214+
ex = ode_sol[2, :]
215+
ey = ode_sol[3, :]
216+
hx = ode_sol[4, :]
217+
hy = ode_sol[5, :]
218+
L = ode_sol[6, :]
219+
cL = cos.(L)
220+
sL = sin.(L)
221+
w = @. 1 + ex * cL + ey * sL
222+
Z = @. hx * sL - hy * cL
223+
C = @. 1 + hx^2 + hy^2
224+
q1 = @. P *((1 + hx^2 - hy^2) * cL + 2 * hx * hy * sL) / (C * w)
225+
q2 = @. P *((1 - hx^2 + hy^2) * sL + 2 * hx * hy * cL) / (C * w)
226+
q3 = @. 2 * P * Z / (C * w)
227+
228+
plt1 = plot3d(1; xlim = (-60, 60), ylim = (-60, 60), zlim = (-5, 5), title = "Orbit transfer", legend=false)
229+
@gif for i = 1:N
230+
push!(plt1, q1[i], q2[i], q3[i])
231+
end every N ÷ min(N, 100)
233232
```
234233

235234
## References

0 commit comments

Comments
 (0)