Roger, I am trying to conduct an analysis of coordination between two adjacent segments called Vector coding (Chang et al., 2008; Journal of Biomechanics). The coupling angle is defined as the inverse tangent of the change in y divided by the change in x (see code below). However, I cannot condition my data such that I avoid the vertical asymptotes of the atan2 function. Can you please offer some suggestions.
x and y are single column arrays with length m.
for i=1:m-1 gamma=atan2((y(i+1)-y(i))/(x(i+1)-x(i))) end