Code covered by the BSD License  

Highlights from
degrees and radians

4.55556

4.6 | 9 ratings Rate this file 25 Downloads (last 30 days) File Size: 1.55 KB File ID: #3263

degrees and radians

by

 

13 Apr 2003 (Updated )

Two helper functions, one converts degrees to radians, the other rads to deg.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information
Description

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

Acknowledgements

This file inspired Deg2rad And Rad2deg Conversion Functions.

MATLAB release MATLAB 6.1 (R12.1)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (11)
01 Nov 2011 Brato CHAKRABARTI

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

19 May 2010 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.

19 Nov 2009 Richard Medlock

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.

21 Aug 2009 Duane Hanselman

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?

13 Aug 2009 Joel

Simple

15 Mar 2008 Carson Smith

Thanks

11 Jan 2008 Atul Kumar  
29 Aug 2007 padmanaban RPS

good yar

18 Nov 2006 Seung-Bin Lim  
29 Nov 2004 ezekiel calderon

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

05 Apr 2004 a a

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

Updates
18 Aug 2009

Modified calculation based on a user suggestion to improve speed.

Contact us