rad2deg.m

来自「JLAB is a set of Matlab functions I have」· M 代码 · 共 33 行

M
33
字号
function[varargout]=rad2deg(varargin)%RAD2DEG  Converts radians to degrees.%%   [D1,D2,...DN]=RAD2DEG(R1,R2,...RN) converts the input angles from%   radians to degrees.  Output angles are in the range [-180,180].%%   See also DEG2RAD, DEG180, DEG360. % %   'rad2deg --t' runs a test.%   __________________________________________________________________%   This is part of JLAB --- type 'help jlab' for more information%   (C) 2006 J.M. Lilly --- type 'help jlab_license' for details if strcmp(varargin{1}, '--t')    rad2deg_test,returnend c=2*pi/360;varargout=varargin;for i=1:nargin;    varargout{i}=angle(rot(varargin{i}))./c;endfunction[]=rad2deg_test th= [0 pi/2 pi 3*pi/2 2*pi 5*pi/2];th2=[0 90   180 -90   0    90];reporttest('RAD2DEG simple',aresame(rad2deg(th),th2))th=360*rand(100,1)-180;reporttest('RAD2DEG inverts DEG2RAD',aresame(rad2deg(deg2rad(th)),th,1e-10))

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?