pan>
0034 
0035 [N,T,D] = size(waveforms);
0036 <span class="keyword">if</span> (~isequal([1,T,D],size(template)))
0037     error(<span class="string">'The second and third dimensions of TEMPLATE must match WAVEFORMS.'</span>);
0038 <span class="keyword">end</span>
0039 
0040 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Setup %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
0041 testoff = (-mx:1/3:mx)';
0042 A = vander(testoff);  A = A(:,end-2:end);
0043 Q = inv(A' * A) * A';  <span class="comment">% Q fits 