Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: Vector Coding
Posted:
Nov 26, 2013 11:57 PM


"Douglas" wrote in message <l73hjp$s9d$1@newscl01ah.mathworks.com>... > My apologies. I still have vertical "deformities" to what should be a smooth curve. If you like, I am more than willing to send you the data and an image of the atan2 curve produced from the atan2(diff(y),diff(x)) calculation. I do not know if I can upload those to this site. > > It appears the deformity occurs when the atan2 data approaches 180 degrees.          The "coupling angle" as defined by Chang et al. does indeed appear to be
atan((y(i+1)y(i))/(x(i+1)x(i))).
What this gives you is the angle measured from the xaxis in a counterclockwise direction over to the vector which points from (x(i),y(i)) to (x(i+1),y(i+1)), with the understanding that if the direction is clockwise instead, the angle is negative. Also if the angle were to exceed pi/2, then pi is subtracted from it, and if it is below pi/2, then pi is added. Thus angles defined by atan would always have to range from pi2 to +p/2.
The quantity
atan2((y(i+1)y(i)),(x(i+1)x(i)))
differs from the atan definition in that its value may range from pi to +pi, so that it can be anywhere in the four quadrants. That is possible because two input arguments are given rather than one.
I looked at a copy of the article "Variability in kinematic coupling assessed by vector coding and continuous relative phase" published in 2010, and it is curious that on the same page as the atan definition was stated, they show a diagram in which the angle of a vector with respect to the xaxis would normally be considered to lie in the second quadrant with a value in excess of pi. My suspicion is that they actually mean the kind of angle that is produced by atan2, but since that notation is not standard, they were content to use atan, and assume that everyone would understand what they really mean.
It is the atan function that makes a sudden change for a vertical vector. As a vector is rotated counterclockwise past the vertical pi/2 angle, it makes a sudden change to pi/2. The atan2 function does not do that but continues to increase continuously until it reaches pi, past which point it sudden changes to pi, but that is for vectors which are pointing in the negative xaxis (horizontal) direction. If one is faced with a need for continuous angle changes beyond the pi to +pi range, matlab has a function called 'unwrap' which can adjust angles by adding or subtracting multiples of 2*pi so as to maintain continuity. Perhaps you might be interested in that function, which is described at:
http://www.mathworks.com/help/matlab/ref/unwrap.html
Roger Stafford



