• angle(x, y)—Returns the angle from the x-axis to a line containing the origin and the point (x, y). Results are in radians between 0 and 2π, excluding 2π.
• atan2(x, y)—Returns the angle from the x-axis to a line containing the origin and the point (x, y). Results are in radians between −π and π, excluding −π. The atan2 function is undefined at (0, 0).
The atan2 function is related to the functions
atan and
arg by the following relationships:
◦ atan2(x, y) = atan(y/x)—Because atan returns values between –π/2 and π/2, you may have to add +/– π to match the results.
◦ atan2(x, y) = arg(x + yi)
If the result is positive, the angle is measured counterclockwise from the x-axis. If the result is negative, the angle is measured clockwise from the x-axis.
Arguments
• x and y are real scalars. They must have compatible units.