⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deg180.m

📁 JLAB is a set of Matlab functions I have written or co-written over the past fifteen years for the p
💻 M
字号:
function[varargout]=deg180(varargin)%DEG180  Converts degrees from the range [0,360] to [-180,180].%%   [TH1,TH2,...THN]=DEG180(TH1,TH2,...THN) converts the range of the%   input angles, which are measured in degrees, to [-180, 180].%%   See also DEG360.%%   'deg180 --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')    deg180_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>180);    if ~isempty(index)        th(index)=th(index)-360;    end    varargout{i}=th;endfunction[]=deg180_testthi=[359 181];tho=[-1 -179];reporttest('DEG180 simple',aresame(deg180(thi),tho))

⌨️ 快捷键说明

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