comparing angles from two trajectories

3 views (last 30 days)
laurie
laurie on 10 Apr 2012
Hello there,
I am trying to compare the angles from two trajectories, (0,0) being at the center of the screen and the trajectories in the whole screen.
What I did was to use Arctan() to determine the polar coordinates rho(t),theta(t) from x(t),y(t) for both trajectories. To avoid problems of angles "jumping" between -pi and +pi I introduced a condition that minimalizes the gap between two successive angles, choosing between the angle returned by arctan() and the angle returned by arctan() +/- 2pi. I get less "jumps" in each angular trajectory but I am still having some important problems :
  • sometimes the trajectory crosses the origin (0,0) so that the angle cannot be calculated and I get "jumps" between the point after and the point before that.
  • this is bad because then it allows the two angular trajectories to differ more than they would differ without the "jump" (angle from the one is angle from the other +/- 2pi)
so i am looking for a way to compute a continuous angular trajectory even when the trajectory hits the origin (0,0), so that i can compare angular trajectories correctly. i could just set the origin elsewhere than in the center of the screen but the problem is that what i am really interested in is the angle with the center of the screen as a reference.
thank you, sorry i don't think this was clear at all
  3 Comments
laurie
laurie on 13 Apr 2012
AWESOME :) i made some minor arrangements to account for the "continuity" problem each time the point crosses the line between -pi and pi and it is now doing exactly what i want !! thank you !!

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!