

function phi=ext_pend_potential(x,y)

global k m L0 L g

sq = sqrt((L-y).^2+x.^2);

phi = m*g*y + (k/2)*(L0-sq).^2;


