% Cost Function for the SIR model
% Marisa Eisenberg 7-29-16 (marisae@umich.edu)

function RSS = sirCost(tspan,params,data,x0fcn,yfcn)
params = abs(params);
[t,x] = ode45(@sirODE,tspan,x0fcn(params),[],params);
y = yfcn(x,params);
RSS = ((data - y))'*((data - y)); %OLS