Re-packaged
This commit is contained in:
24
julia/src/find_closest.jl
Normal file
24
julia/src/find_closest.jl
Normal file
@@ -0,0 +1,24 @@
|
||||
using NLsolve
|
||||
|
||||
function treat_inputs(x::AbstractVector)
|
||||
n::Int = length(x)/3
|
||||
reshape(x,(3,n))'
|
||||
end
|
||||
|
||||
function single_shoot(start::Vector{Float64},
|
||||
final::Vector{Float64},
|
||||
craft::Sc,
|
||||
μ::Float64,
|
||||
t0::Float64,
|
||||
tf::Float64,
|
||||
x0::AbstractVector,
|
||||
tol=1e-2)
|
||||
|
||||
function f!(F,x)
|
||||
F[1:6] .= prop(treat_inputs(x), start, craft, μ, tf-t0)[1][end,:] - final
|
||||
F[7:3n] .= 0.
|
||||
end
|
||||
|
||||
return nlsolve(f!, x0, ftol=tol, autodiff=:forward, iterations=10_000)
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user