I am trying to check weather my Differential Equation implemented using DifferentialEquation.jl matches the results obtained in Matlab. I learnt I could do this by implementing the same differential equation using MATLABDiffEq.jl and ParameterisedFunctions.jl. My code contains several if-statements that look something like this:
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())
However, when I debug I notice that the u0 passed does not contain number but instead it is something like this.
I believe this is due to the metaprogramming capabilities of Julia. Because of which I get a type error in the if-statement
Blockquote TypeError: non-boolean (Num) used in boolean context
How do I go about this and implement my quite complex diff equation as a parameterised function?