Skip to main content



Force Objects

QuIRK includes a class of inter-body force objects that easily account for interactions between bodies, such as springs and dampers.

The Force Constructor

To create a force object, use the syntax:

>> fc = force(actionBody, reactionBody, forceFn, torqueFn, ...
     frame)
ans = 
   |<===    QuIRK: force
      ===>|  Current value: 0  0  0
		

The arguments forceFn and torqueFn should refer to function handles of the form forceFn = @(actionBody, reactionBody, time)( ) and torqueFn = @(actionBody, reactionBody, time)( ). These functions may easily reference properties of the two bodies. For example,

>> fc.forceFn = @(aB, rB, t)( -2*(aB.pos - rB.pos) );
		

specifies a simple spring between bodies aB and rB, with a spring constant of k = 2 N/m. (The force +forceFn acts on the first body, while -forceFn acts on the second body.) The frame argument allows you to choose which frame of reference the force function is written in, and defaults to the inertial frame.

Springs

The QuIRK spring function is a shortcut that creates an inter-body force object representing a simple spring between the two bodies. Its functional form is

>> spr = spring(firstBody, secondBody, stiffness, damping, ...
     equilibriumLength, frame)
		

Currently, QuIRK only supports scalar stiffness and damping values and the spring acts between the bodies' centers of mass.

Back to top


QuIRK

Contributors

  • Joseph Shoer

Download QuIRK

Requires MATLAB 2009 or later