##################################################################
## Plot a simple depiction of the inverted pendulum
## Good for testing your assignment 4 code
##################################################################
## Args:
## angle  - the angle of the pendulum with vertical
## bpos   - the base of the stick position
## omega  - the angular velocity of the flywheel
## r      - the radius of the flywheel
## d      - the length of the connecting rod
## l      - the length of the stick
##################################################################
function stick(angle, bpos, omega, r, d, l)
  x0 = bpos;
  y0 = 0;
  [x1, y1] = xypos(angle, bpos, l);
  st = [x0, y0; x1, y1];
  base = [-l-r, 0 ; l+r, 0];
  axis([1,2,3,4],"square");
  gplot [-l-r : l+r] [-l-r : l+r] st with lines, base with lines;
endfunction
