Main Content

# deg2rad

Convert angle from degrees to radians

## Syntax

``R = deg2rad(D)``

## Description

example

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

## 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`.

## Version History

Introduced in R2015b