Skip to content

Commit cd76726

Browse files
authored
Some integrator errors
1 parent 6d93433 commit cd76726

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/integration.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function discrete_dynamics(::Type{RK3}, model::AbstractModel, x::SVector{N,T}, u
66
t, dt::T) where {N,M,T}
77
k1 = dynamics(model, x, u, t )*dt;
88
k2 = dynamics(model, x + k1/2, u, t + dt/2)*dt;
9-
k3 = dynamics(model, x - k1 + 2*k2, u, t )*dt;
9+
k3 = dynamics(model, x - k1 + 2*k2, u, t + dt )*dt;
1010
x + (k1 + 4*k2 + k3)/6
1111
end
1212

@@ -21,7 +21,7 @@ function discrete_dynamics(::Type{RK4}, model::AbstractModel, x::SVector, u::SVe
2121
k2 = dynamics(model, x + k1/2, u, t + dt/2)*dt
2222
k3 = dynamics(model, x + k2/2, u, t + dt/2)*dt
2323
k4 = dynamics(model, x + k3, u, t + dt )*dt
24-
x + (k1 + 4k2 + 4k3 + k4)/6
24+
x + (k1 + 2k2 + 2k3 + k4)/6
2525
end
2626

2727

0 commit comments

Comments
 (0)