latent;

clear <span class="string">q</span>;
xi = t1*(0:size(qq,1)-1); xn = 0:t2:(size(qq,1)-1)*t1;
<span class="keyword">for</span> i = 1:size(qq,2), q(:,i) = interp1(xi,qq(:,i),xn); <span class="keyword">end</span>

<span class="keyword">for</span> i=1:size(q,1)
  x     = q(i,10);
  y     = q(i,11);
  theta = q(i,14);
  phi   = q(i,15);
  psiw  = -q(i,16);
  psif  = q(i,17);
  psit  = q(i,18);

  A = [  cos(phi)             sin(phi)              0
    -sin(phi)*cos(theta)  cos(phi)*cos(theta)  -sin(theta