📄 deg360.m
字号:
function[varargout]=deg360(varargin)%DEG360 Converts degrees from the range [-180,180] to [0,360].%% [TH1,TH2,...THN]=DEG360(TH1,TH2,...THN) converts the range of the% input angles, which are measured in degrees, to [0, 360].%% See also DEG180.%% 'deg360 --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') deg360_test,returnend varargout=varargin;for i=1:nargin; th=varargin{i}; index=find(isfinite(th)); if ~isempty(index) if minmin(th(index))<-180 || maxmax(th(index))>360 error(['Range of TH' int2str(i) ' lies outside [-180,360]']) end else error(['Range of TH' int2str(i) ' lies outside [-180,360]']) end index=find(th<0); if ~isempty(index) th(index)=th(index)+360; end varargout{i}=th;endfunction[]=deg360_testthi=[-1 -179];tho=[359 181];reporttest('DEG360 simple',aresame(deg360(thi),tho))th1=360*rand(100,1);th2=deg360(deg180(th1));reporttest('DEG360 inverts DEG180',aresame(th1,th2)) %reporttest(' DEG360 ',aresame())
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -