File Exchange

image thumbnail

degrees and radians

version (1.55 KB) by Richard Medlock
Two helper functions, one converts degrees to radians, the other rads to deg.

1 Download

Updated 18 Aug 2009

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

Two simple functions to save time writing out the code to do a degrees to radians calculation or vice versa.

Cite As

Richard Medlock (2020). degrees and radians (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (13)

Abel Luis

meu, você é o cara

Exactly what I was looking for, thank you.

Makes computation time longer. Very simple. Yet very useful at times.

Jeff Gibson

Good simple function. Any true programmer understands the importance of maintainability and code reuse from a software engineering perspective, espcially when the performance hit is infinitesimal.

Duane - yes you are probably correct, the original calculation however was done differently and was shorter. However, the benefit for me personally is two fold - 1) it makes it easier to troubleshoot the code because it's more readable and 2) repetitive calculations are generally best kept as functions which enable you to more easily find and replace them, and avoid mistakes in typing out duplicate code. But everyone has their own preferred way of doing things.

How does this save time? Function calling overhead makes this computationally slower than direct multiplication. Typing the function call degrees(theta) is 14 keystrokes whereas 180/pi*theta is only 12 keystrokes. The same is true for typing radians(theta). So how does this save time?



Carson Smith


Atul Kumar

padmanaban RPS

good yar

Seung-Bin Lim

ezekiel calderon

if only i knew earlier how to install the file, i would be a lot easier.

a a

thank you so much. you helped me out a whole lot.


Modified calculation based on a user suggestion to improve speed.

MATLAB Release Compatibility
Created with R12.1
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: deg2rad and rad2deg conversion functions