function bestconstant = brenna1(usstates)
out1=projectscrapefunWY(usstates);
trange2 = [0 trange(end)];
c0 = [0.25 0.25 0.25 0.25 0.25];
Model1 = ode45(@(t,z)ourODEmodel(t,z,c0), trange2, y0);
simY = deval(Model1, trange);
plot(trange, simY, '-r') ;
legend('experiment','model with initial guess')
Objective = @(x) objFcn(x, trange, Yexp,trange2,y0);
bestc = lsqnonlin(Objective, c0, lb, ub);
Model1 = ode45(@(t,z)ourODEmodel(t,z,bestc), trange2, y0);
bestY = deval(Model1, trange);
plot(trange, bestY, '-g')
legend('Exp Data','Initial Param','Best Param');
function f = ourODEmodel(t, z, c)
f(1) = (-c0(1)*S*I) +c0(2) -(c0(3)*S);
f(2)=(c0(1)*S*I)-(c0(3)*c0(4))*E;
f(3)=c0(4)*E-(c0(5)+c0(3))*I;
function accuracy = objFcn(x,trange,Yexp,trange2,y0)
Model1 = ode45(@(t,z)ourODEmodel(t,z,x), trange2, y0);
simY = deval(Model1, trange);
0 Comments
Sign in to comment.