function dx = ode_extended(t, x, k) % You won't need t here, only x and k % Compute the Jacobians Jx = ??? Jk = ??? % Put current sensitivities in matrix S S = [x(3), x(4); x(5), x(6)]; % Compute derivatives of the sensitivities dS = Jx*S + Jk; % Output right-hand side of the extended ODE dx = [k(1)*x(1) - k(2)*x(1)*x(2); k(2)*x(1)*x(2) - x(2); dS(1,1); dS(1,2); dS(2,1); dS(2,2)]; end