The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Vector Coding
Replies: 6   Last Post: Nov 26, 2013 11:57 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Roger Stafford

Posts: 5,929
Registered: 12/7/04
Re: Vector Coding
Posted: Nov 26, 2013 11:57 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Douglas" wrote in message <l73hjp$s9d$>...
> 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


What this gives you is the angle measured from the x-axis 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


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 x-axis 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 x-axis (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:

Roger Stafford

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.