I have a function (for an SIR model), and then a script that solves this function and compares it to the data I am trying to fit this model to. Thus I am trying to run a for loop to change a parameter in the function in order to optimize the fit. I'm wondering how to change my the (r) and (a) parameters in a for loop without having to change them by hand:
function ydot=epidemic(t,y)
r=0.000001;
a=1/3;
ydot=zeros(3,1);
ydot(1)=-r*y(1)*y(2);
ydot(2)=r*y(1)*y(2)-a*y(2);
ydot(3)=a*y(2);
end
and
[t,y]=ode45('epidemic',[0:222], [70500,1,0])
Thanks