function zdot=fourbarrhs(t,z)
%This is highly underdocumented since all commands
%were explained in lecture.

global om1 L1 L2 L3

th1=z(1);  th2=z(2);  th3=z(3);


A=[L2*sin(th2)  L3*sin(th3);
   L2*cos(th2)  L3*cos(th3) ];
b=-L1*om1*[sin(th1) cos(th1)]';

y=A\b;

th1dot = om1;
th2dot = y(1);
th3dot = y(2);

zdot = [th1dot th2dot th3dot]';
