% In order to use the skeleton, you must define y and K as follows: % y = [E S ES EI P I] % % K = [k_1 k_neg_1 k_2 k_neg_2 k_3] function YOURNAMEHERE() function res = calcfittedy(K, t_points, y_0) [t_out, y_out] = %some function of ode45 and diffeq% res = y_out; end % Write the differential equations for E, S, ES, EI, P and I, paying % special attention to the ordering of the variables specified above. % Eg. E = y(1) and k_2 = K(3) function dydt = diffeq(t, y, K) %d[E]/dt = ?????????????? % dydt(1,1) = % YOUR CODE GOES HERE% %d[S]/dt = ?????????????? % dydt(2,1) = % YOUR CODE GOES HERE% %d[ES]/dt = ?????????????? % dydt(3,1) = % YOUR CODE GOES HERE% %d[EI]/dt = ?????????????? % dydt(4,1) = % YOUR CODE GOES HERE% %d[P]/dt = ?????????????? % dydt(5,1) = % YOUR CODE GOES HERE% %d[I]/dt = ?????????????? % dydt(6,1) = % YOUR CODE GOES HERE% end % Define values for E_0, S_0, ES_0, EI_0, P_0 and I_0 % YOUR CODE GOES HERE y_0 = [E_0 S_0 ES_0 EI_0 P_0 I_0]; % Assign the first column of the data matrix to t_meas and the remaining % columns to y_meas % YOUR CODE GOES HERE % Plot y_meas vs. t_meas as circles, with commands for a legend % and axis labels % YOUR CODE GOES HERE % Determine optimal parameters K_est = [0 0 0 0 0]; K_opt = lsqcurvefit(@(K, t_points)calcfittedy(K, t_points, y_0), K_est, t_meas, y_meas); K_opt % Define your predicted time points and calculate y_pred at each time % point using calcfittedy and K_opt t_pred = %YOUR CODE GOES HERE% y_pred = %YOUR CODE GOES HERE% hold on; % Command to plot y_pred vs. t_pred as lines % YOUR CODE GOES HERE end