I’m new to Julia and I have been working on ODE solvers for my first project .I recently got my hands onto some data which was generated using Matlab. I have been trying to replicate the results using the Julia DifferentialEquation.jl package, but unfortunately there is some difference in the outputs. You see the difference in the image below. The golden line represents the Matlab results, while the other lines represents the results obtained from different solvers. So far I have set the reltol to the same as in Matlab, but I am not sure if I need to change any other parameters.

Can someone with experience in Matlab and Julia help me achieve same or very similar results as observed in Matlab using the ode15s solver.

And the abstol? Did you do a convergence test, bringing it down to 1e-12 or 1e-14 to see if the two converge to the same values? And did you test using MATLABDiffEq.jl?

Correct me if I’m wrong here, the MATLABDiffEq.jl package expects it’s differential equation function to be a Parameterized function, but unfortunately you cannot use if statements with the passed u values. My actual diffeq has multiple such if-statements. Is there a work around?

function diffeq(du,u,p,t)
if u[1]>0
du[1]= u[1]+10
end
end
u0=[0.0,1.0]
tspan= (0,1)
prob= ODEProblem(diffeq,u0,tspan,p)
sol= solve(prob, MATLABDiffEq.ode15s())

I don’t understand that one, but it looks like a problem communicating with MATLAB. I don’t have copy to test with, but if you can make a small example that exhibits that error it would likely be worth opening an issue with MATLABDiffEq.jl