% Drqws the level curves of energy
% for the undamped pendulum
% y" + sin(y) = 0.


[Y,V] = meshgrid(-6.4:.2:6.4,-2.4:.2:2.4);

Z=-cos(Y) + (0.5*V).*V; %E=0.5 v*v - cos(y)

 w=-2.2:.4:2.6;
 
 contour(Y,V,Z,w)