Is there a difference between degtorad and deg2rad in MATLAB? Is there a benefit of one over the other, like speed (or some other metric I didn't think of)?
http://www.mathworks.com/help/map/ref/degtorad.html http://www.mathworks.com/help/map/ref/deg2rad.html
Thank-you excaza for telling me how to view the source code for both functions.
Thank-you hbaderts for telling me to check licenses in use.
Here is what I've found.
They are functionally identical. Here are the only differences I could find:
1. The bolded line below that states that deg2rad has been replaced by degtorad.
2. They use different licenses. deg2rad requires the map_toolbox, while degtorad does not.
degtorad.m
function angleInRadians = degtorad(angleInDegrees)
% DEGTORAD Convert angles from degrees to radians
%
% angleInRadians = DEGTORAD(angleInDegrees) converts angle units from degrees to radians.
%
% Example
% -------
% Compute the tangent of a 45-degree angle
% tan(degtorad(45))
%
% See also: fromDegrees, fromRadians, toDegrees, toRadians, radtodeg.% Copyright 2009 The MathWorks, Inc.
angleInRadians = (pi/180) * angleInDegrees;
deg2rad.m
function angleInRadians = deg2rad(angleInDegrees)
% DEG2RAD Convert angles from degrees to radians
%
% DEG2RAD has been replaced by DEGTORAD.
%
% angleInRadians = DEG2RAD(angleInDegrees) converts angle units from degrees to radians.% Copyright 2007-2009 The MathWorks, Inc.
angleInRadians = (pi/180) * angleInDegrees;
License Difference:
degtorad(180)
ans =
3.1416
license('inuse')
matlabdeg2rad(180)
ans =
3.1416
license('inuse')
map_toolbox
matlab