Pars a fluctuating parameter in an ODE

Dear Julia users,

I am new to julia and I want to solve an ODE system with some fluctuating parameters.
Let say that I have a fluctuating temperature T as function of time:

T = 18
time = collect(0:0.01:365)
vecT = T.+0.2*T*sin.((1/10)*2*pi.*time);
fig, ax=PyPlot.subplots(figsize=(8,2))
ax.plot(vecT)

Let say I have a parameter that is a funciton of T in my ODE. How can I implement it?

# The ode model
function dudt(u,p,t)  
    a = p[1];
    b = p[2];
    μ  = a*exp(-b/T(t))
    ψ  = p[3];
  
    return μ-ψ  
end

Many thanks for your help

Just define f(t) = T.+0.2*T*sin.((1/10)*2*pi.*t) and then use it inside of your ODE

Thanks a lot @ChrisRackauckas ChrisRack.
I have an additional question, if my temperature is not a function but a vector of data. Is there is a way do take the T(t) in the ode function?

1 Like

Thanks!