I’m using DifferentialEquations.jl package to solve a delay differential equations problem. However, the result is different from what I got in Matlab. Can anybody tell me which part goes wrong? ><
This is my code in Julia:
using DifferentialEquations
function bc_model(du,u,h,p,t)
mu0, mu1, mu2, mu3, mu4, k0, k1, k2, k3, k4, k5, k6, n, P0, tau= p
hist5 = h(p, t-tau)[5]
hist2 = h(p, t-tau)[2]
du[1] = -mu0*u[1] - k1*u[1] + k0*(1/1+(hist5/P0)^n)
du[2] = -mu1*u[2] + k1*u[1]
du[3] = -mu2*u[3] + 2*k4*u[4] - 2*k3*u[3]^2 + k2*hist2
du[4] = -mu3*u[4] + k3*u[3]^2 - k4*u[4] - k5*u[4] + k6*u[5]
du[5] = -mu4*u[5] + k5*u[4] - k6*u[5]
end
h(p, t) = ones(5)
tau = 8
lags = [tau]
P0 = 1250; n = 5;
mu0 = 0.03; mu1 = 0.03; mu2 = 0.3; mu3 = 0.03; mu4 = 0.03;
k0 = 10; k1 = 1; k2 = 10; k3 = 0.01; k4 = 0.001; k5 = 10; k6 = 0;
p = (mu0, mu1, mu2, mu3, mu4, k0, k1, k2, k3, k4, k5, k6, n, P0, tau)
tspan = (0.0, 1000.0)
u0 = [1.0, 1.0, 1.0, 1.0, 1.0]
prob = DDEProblem(bc_model,u0,h,tspan,p, constant_lags=lags)
alg = MethodOfSteps(BS3())
sol = solve(prob,alg)
using Plots; plot(sol)