MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayMATLAB Central > MATLAB Newsreader > Angles flipping at 0 and 180 degrees 

Subject: Angles flipping at 0 and 180 degrees From: Lydia_300 Date: 8 Jun, 2012 15:46:12 Message: 1 of 7 
I am trying to calculate angles between two vectors. However when the angle reaches 0 or 180 degrees the answer is flipped and instead of increasing it decreases. Is there a code I can use to prevent this from happening? I am currently using the magnitudes of the vectors along with Acos to calculate the angles in radians and then convert them into degrees using the radtodeg function. 
Subject: Angles flipping at 0 and 180 degrees From: Nasser M. Abbasi Date: 8 Jun, 2012 16:02:29 Message: 2 of 7 
On 6/8/2012 10:46 AM, Lydia_300 wrote: 
Subject: Angles flipping at 0 and 180 degrees From: Steven_Lord Date: 8 Jun, 2012 17:06:52 Message: 3 of 7 

Subject: Angles flipping at 0 and 180 degrees From: Star Strider Date: 8 Jun, 2012 20:20:21 Message: 4 of 7 

Subject: Angles flipping at 0 and 180 degrees From: Greg Heath Date: 8 Jun, 2012 21:07:17 Message: 5 of 7 
On Jun 8, 1:06 
Subject: Angles flipping at 0 and 180 degrees From: Matt J Date: 9 Jun, 2012 10:28:07 Message: 6 of 7 
"Lydia_300" wrote in message <jqt6o4$9vl$1@newscl01ah.mathworks.com>... 
Subject: Angles flipping at 0 and 180 degrees From: Star Strider Date: 9 Jun, 2012 17:26:07 Message: 7 of 7 
> Why would you want to prevent it from happening? Once the angle reaches 0 or 180, the vectors start to become closer together again. It makes perfect physical sense that the angle starts to decrease. 
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.