atan2d

Four-quadrant inverse tangent, with the result in degrees.

Category: Mathematics > Elementary Math

Syntax

D = atan2d(Y, X)

Returns the angle of the point (X, Y) in degrees.

Description

atan2d is atan2 expressed in degrees. The point (-1, 1) gives 135, and (-1, -1) gives -135. The argument order is the same as atan2: the y-coordinate first.

Input arguments

Y
Real array of y-coordinates.
X
Real array of x-coordinates, compatible in size with Y.

Output arguments

D
Angle in degrees, in [-180, 180].

Example

Angle in degrees

atan2d([1 1 -1 -1], [1 -1 -1 1])
Output
ans = 1×4

    45   135  -135   -45

See also

atan2 atand angle rad2deg