Two simple functions to save time writing out the code to do a degrees to radians calculation or vice versa.
Richard Medlock (2020). degrees and radians (https://www.mathworks.com/matlabcentral/fileexchange/3263-degrees-and-radians), MATLAB Central File Exchange. Retrieved .
meu, você é o cara
Exactly what I was looking for, thank you.
Makes computation time longer. Very simple. Yet very useful at times.
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?
if only i knew earlier how to install the file, i would be a lot easier.
thank you so much. you helped me out a whole lot.
Modified calculation based on a user suggestion to improve speed.
Inspired: deg2rad and rad2deg conversion functions