DifferentialEquations 2nd order ODE interpolation for position

I am modeling simple projectile motion using the DifferentialEquations.jl package. I have read in the documentation that you can interpolate based on time to get an answer for an exact time.

Instead of time I have been looking for a way to interpolate based on position. For example I want the vertical position of the projectile at evenly spaced horizontal increments. Is this functionality already in the DifferentialEquations package or do I need to use a package like CurveFit.jl on the horizontal and vertical positions to approximate a solution at evenly spaced horizontal intervals? Thanks.

I think what you want can be achieved easily with one of the interpolation packages, e.g. Interpolations.jl
Then you do something like:

using Interpolations
sol = solve(problem, solver) # solve the ODE

# interpolate at fixed time
tfix = 0.5
smoothfunction_fixed_t = linear_interpolation(xgrid, sol(tfix))
# can now do smoothfunction_fixed_t(x)

# interpolate everything
tgrid = range(0,sol.t[end]; length=100)
smoothfunction = linear_interpolation((xgrid, tgrid), mapreduce(sol, hcat, tgrid))
# can now do smoothfunction(x,t)

Edit:sorry, misunderstood the problem. Ignore me

old response

You can use the solver option saveat=your_stepsize to do this at solve if you know your stepsize in advance.

Common Solver Options (Solve Keyword Arguments) · DifferentialEquations.jl

I think you can also use the built in interpolations by calling the solution object as sol([t_start:step:t_end])

Solution Handling · DifferentialEquations.jl