For a list of 2d coordinates I want to determine the variation of the embedded angle between the line which is connecting each coordinate and a fixed reference point and the x axis.
(* some example coordinates *)
step = 0.1;
x = Table[Sin[alpha] + Sin[0.7 alpha], {alpha, 0, 2*Pi, step}];
y = Table[Cos[2 alpha], {alpha, 0, 2*Pi, step}];
coordinates = Transpose[{x, y}];
Show[
ListPlot[coordinates, AspectRatio -> Automatic, PlotRange -> All,
Frame -> True, FrameLabel -> {"x", "y"}],
Graphics[{Red, Line[{{0, 0}, {x[[5]], y[[5]]}}]}],
Graphics[{Red, Line[{{0, 0}, {x[[5]], 0}, {x[[5]], 0}}]}],
Graphics[{Red, Text["angle", {0.3, 0.1}]}],
Graphics[{Red,
Circle[{0, 0},
x[[5]], {VectorAngle[{x[[5]], 0}, {x[[5]], y[[5]]}], 0}]}]
]
{xref, yref} = {0, 0}; (* reference point *)
x = x - xref;
y = y - yref;
angle = ArcTan[x, y ]*180/Pi;
n = Length@coordinates;
coordinateNumber = Range[n];
data = Transpose[{coordinateNumber, angle}];
Question: How can I plot the angles where angle-"jumps" occur as a continuation of the data points seen before.
Here are three examples which are showing how the angle plot looks like (top: plot of data
) and what I want to receive (below).
Case 1: x = Table[Sin[alpha] + Sin[0.7*alpha], {alpha, 0, 2*Pi, step}];
Case 2: x = Table[Sin[0.9*alpha] + Sin[0.7*alpha], {alpha, 0, 2*Pi, step}];
Case 3:
step = 0.01;
x = Table[Sin[alpha] + Sin[0.7 alpha], {alpha, 0, 10*Pi, step}];
y = Table[Cos[2 alpha], {alpha, 0, 10*Pi, step}];