function xdot=cart(t,x)
%  xdot=cart(t,x)
% Nonlinear equations of motion for the Cart and 
% pendulum system, for use by the MATLAB ode solver ode23

	g=10;M=1;u=0; %control force for free motion
	%u=[2.6 -53.6 5.4 -9.4]*x; % a linear feedback law
	c2=cos(x(2));s2=sin(x(2));
	xdot=[x(3:4);inv([M+1 -c2;-c2 1])*[u-x(4)^2*s2;(g-x(3)*x(4))*s2]];	
