%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % doubleydot.m % Double ydot.m %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function ydot=doubleydot(t,y, friction) g=9.8;length=1; ydot(1) = y(2); ydot(2) = (((-3*g*sin(y(1))) - (g*sin(y(1)-y(3))*((y(4)^2)-(y(2)^2)*cos(y(1)-y(3)))))/(3 - cos(2*y(1) - 2*(y(3))))) - friction*y(2); ydot(3) = y(4); ydot(4) = (2*sin(y(1) - y(3)) * (2*(y(2)^2) + (2*g*cos(y(1))) + (y(4)^2*cos(y(1)-y(3))))) / (3- cos(2*y(1) - 2*y(3)));