ATAN2 overloads the atan2 operator for Analysis objects. Four quadrant inverse tangent. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: ATAN2 overloads the atan2 operator for Analysis objects. Four quadrant inverse tangent. REMARK: The data-object of the output AO is the same as the data-object of the first AO input. The result of the atan2 will be copied to the y values of this data-object. CALL: ao_out = atan2(ao1, ao2); ao_out = atan2(ao1, ao2); ao_out = atan2(ao_vec1, ao_vec2); M-FILE INFO: Get information about this methods by calling >> ao.getInfo('atan2') Get information about a specified set-plist by calling: >> ao.getInfo('atan2', 'None') VERSION: $Id: atan2.m,v 1.8 2008/09/05 11:05:28 ingo Exp $ HISTORY: 16-05-2008 Diepholz Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % ATAN2 overloads the atan2 operator for Analysis objects. Four quadrant inverse tangent. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: ATAN2 overloads the atan2 operator for Analysis objects. 0005 % Four quadrant inverse tangent. 0006 % 0007 % REMARK: The data-object of the output AO is the same as the data-object 0008 % of the first AO input. The result of the atan2 will be copied to 0009 % the y values of this data-object. 0010 % 0011 % CALL: ao_out = atan2(ao1, ao2); 0012 % ao_out = atan2(ao1, ao2); 0013 % ao_out = atan2(ao_vec1, ao_vec2); 0014 % 0015 % M-FILE INFO: Get information about this methods by calling 0016 % >> ao.getInfo('atan2') 0017 % 0018 % Get information about a specified set-plist by calling: 0019 % >> ao.getInfo('atan2', 'None') 0020 % 0021 % VERSION: $Id: atan2.m,v 1.8 2008/09/05 11:05:28 ingo Exp $ 0022 % 0023 % HISTORY: 16-05-2008 Diepholz 0024 % Creation 0025 % 0026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0027 0028 function varargout = atan2 (varargin) 0029 0030 % Check if this is a call for parameters 0031 if utils.helper.isinfocall(varargin{:}) 0032 varargout{1} = getInfo(varargin{3}); 0033 return 0034 end 0035 0036 % Collect input variable names 0037 in_names = cell(size(varargin)); 0038 for ii = 1:nargin,in_names{ii} = inputname(ii);end 0039 0040 % Collect all AOs 0041 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names); 0042 0043 % Decide on a deep copy or a modify 0044 bs = copy(as, nargout); 0045 0046 % Check input arguments number 0047 if length(bs) ~= 2 0048 error ('### Incorrect inputs. Please enter 2 AOs'); 0049 end 0050 0051 % Apply method to all AOs 0052 bs = applyoperator(bs, ao_invars, 'atan2', 'atan2', getDefaultPlist, getInfo); 0053 0054 % Set output 0055 if nargout == 1 0056 varargout{1} = bs; 0057 end 0058 end 0059 0060 %-------------------------------------------------------------------------- 0061 % Get Info Object 0062 %-------------------------------------------------------------------------- 0063 function ii = getInfo(varargin) 0064 if nargin == 1 && strcmpi(varargin{1}, 'None') 0065 sets = {}; 0066 pl = []; 0067 else 0068 sets = {'Default'}; 0069 pl = getDefaultPlist; 0070 end 0071 % Build info object 0072 ii = minfo(mfilename, 'ao', '', utils.const.categories.trig, '$Id: atan2.m,v 1.8 2008/09/05 11:05:28 ingo Exp $', sets, pl); 0073 end 0074 0075 %-------------------------------------------------------------------------- 0076 % Get Default Plist 0077 %-------------------------------------------------------------------------- 0078 function pl_default = getDefaultPlist() 0079 pl_default = plist(); 0080 end 0081