Main Content

rad2deg

Convert angle from radians to degrees

Description

example

D = rad2deg(R) converts angle units from radians to degrees for each element of R.

Examples

collapse all

Convert pi into degrees.

D = rad2deg(pi)
D = 180

Specify the mean radius of Earth and the distance from Munich to Bangalore measured along the Earth's surface (in kilometers). Compute the spherical distance between Munich and Bangalore in degrees.

dist = 7194;
radEarth = 6371;
R = dist/radEarth;
D = rad2deg(R)
D = 64.6972

Input Arguments

collapse all

Angle in radians, specified as a scalar, vector, matrix, or multidimensional array. If R contains complex elements, rad2deg converts the real and imaginary parts separately.

Data Types: single | double
Complex Number Support: Yes

Output Arguments

collapse all

Angles in degrees, returned as a scalar, vector, matrix, or multidimensional array. D is the same size as R.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

Version History

Introduced in R2015b

See Also