%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Simple ODE system for double pendulum %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function dx_dt = f(t,x) %Since there are 2 ODE of degree 2, you can expect that your state %will be made of 4 variables. %shortcuts x1 = x(1); %theta1 x2 = x(2); %theta1_dot x3 = x(3); %theta2 x4 = x(4); %theta2_dot %global variable: global g_L %define your derivative here: dx_dt = [];