Main Content

deg2rad

Convert angle from degrees to radians

Description

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

example

Examples

collapse all

Convert a 90 degree angle into radians.

R = deg2rad(90)
R = 
1.5708

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

D = 64.7;
radEarth = 6371;
R = deg2rad(D);
dist = radEarth*R
dist = 
7.1943e+03

Input Arguments

collapse all

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

Data Types: single | double
Complex Number Support: Yes

Output Arguments

collapse all

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

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