Help to adapt the resolution of an ODE in Matlab to Julia

To interpolate the second-order derivative, you can use this:

ts = LinRange(t[1], t[2], 200)
z = sol(ts, Val{0})
dz = sol(ts, Val{1})

using Plots 
plot(sol)
plot!(ts, dz[1,:])

# or 
plot(ts, [z[2,:] z[1,:] dz[1,:]] )

The sol(...) syntax is used for interpolation, see Solution Handling · DifferentialEquations.jl
and the Val{1} indicates that we want the first derivative of the solution.

Since you have a second-order problem, the solution vector has the form z = (u', u) and accordingly we have z' = (u'', u'). Therefore we get dz[1,:] ~ u''.

2 Likes