%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Compute trajectory of double pendulum %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tspan = [0:0.01:10]; % time boundaries, note the syntax for explicit time step theta10 = pi/2; % initial angle theta1 theta1_dot0 = 0; % initial velocity theta1_dot theta20 = pi/2; % initial angle theta2 theta2_dot0 = 0; % initial velocity theta2_dot %initial state x0 = [theta10;theta1_dot0;theta20;theta2_dot0]; %the only real parameter in those equations is 'g/l', that we %declare as a global veriable: global g_L g_L=10; %Call to the matlab solver: [t,x] = ode45('f',tspan, x0); %Feel free to plot your results, or compare to the ones given in %the testcase