Hi I am trying to run the following code but I get an error when I try to 
run the model (evaluate the result variable (calling the ODE23))

the error is: Error array could not be broadcast to a common size

Does anyone have any idea why? Thanks in advance


# Load libraries
using ODE
using DataFrames
using Gadfly

# Define the model
# Has to return a column vector
function SIR(t,x,p)
    S=x[1]
    I=x[2]
    R=x[3]
    beta=p[1]
    gamma=p[2]
    N=S+I
    dS=-beta*S*I/N
    dI=beta*S*I/N-gamma*I
    dR=gamma*I
    return([dS;dI;dR])
end

# Initialise model
t = linspace(0,500,101);
inits=[9999,1,0];
p=[0.1,0.05];


# Run model
result=ode23((t,x)-> SIR(t,x,p),t,inits);




Reply via email to