Fun Control Experiments with Matlab and a Joystick

  • demo.m Demo with all three systems and basic controllers (m-file).
  • jstick.dll Joystick interface to Matlab (dll). May need to use Microsoft's Internet Explorer to download.
  • bbeam.m Ball and beam simulation (m-file).
  • invpend.m Inverted pendulum simulation (m-file).
  • flex.m Flexible beam simulation (m-file).
  • bbeam.jpg Photo of actual ball and beam system (jpg).
  • flex.jpg Photo of actual flexible beam system (jpg).
  • paper.pdf * Description of the experiments.


  • * The paper appeared in the Proc. of the IEEE Conference on Decision and Control, Maui, HI, Dec. 2003. ©2003 IEEE. Personal use of this material is permitted. However, permission to reprint/republish this material for advertising or promotional purposes or for creating new collective works for resale or redistribution to servers or lists, or to reuse any copyrighted component of this work in other works must be obtained from the IEEE.

    Create your own fun experiments with a multi-axis joystick interface to Matlab (dll). Download jst.dll (may need to use Microsoft's Internet Explorer).
    Typing h=jst.dll returns:
    h[1]: longitudinal deflection (pitch), from -1 to 1.
    h[2]: lateral deflection (roll), from -1 to 1.
    h[3]: rotational deflection (yaw), from -1 to 1.
    h[4]: slider (thrust), from -1 to 1.
    h[5]: buttons (button1 + button2 * 2 +  button 3 *4...,
          where button1 = 1 if pressed and 0 otherwise.

    NOTE: to avoid warning messages with recent versions of Matlab, change the extension of the dll's to mexw32. In other words, simply change the file names to jst.mexw32 and jstick.mexw32 after downloading them.

    NEW: courtesy of Johannes Edrén, extensions of the jst dll allowing the simultaneous use of two joysticks jst.mexw32jst2.mexw32, and the same for 64-bit systems jst.mexw64jst2.mexw64. Test the dll's using testjst.m (stop by typing Ctrl-C).


    This web site is maintained by Professor Marc Bodson, of the Department of Electrical and Computer Engineering at the University of Utah. Please see the University of Utah Web disclaimer. For questions or comments, please send an e-mail to bodson@ece.utah.edu.

    Last updated: March 17, 2011..