lp = int.kinemat.ovlp_n;
            vel  = int.kinemat.vel_n;
            res  = this.residue;
            kl   = this.stiff;
            ku   = this.unload_stiff;

            <span class="comment">% Elastic force according to loading or unloading behavior</span>
            <span class="keyword">if</span> (vel &gt; 0) <span class="comment">% loading</span>
                f = kl * ovlp;
            <span class="keyword">elseif</span> (vel &lt; 0 &amp;&amp; ovlp &gt; res) <span class="comment">% unloading