diff m-toolbox/classes/@ao/sin.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@ao/sin.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,73 @@
+% SIN overloads the sin method for analysis objects.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: SIN overloads the sin operator for analysis objects.
+%
+% CALL:        ao_out = sin(ao_in);
+%              ao_out = sin(ao_in, pl);
+%              ao_out = sin(ao1, pl1, ao_vector, ao_matrix, pl2);
+%
+% POSSIBLE VALUES: ao_in  = [ao2 ao3]
+%                  ao_in  = ao_vector
+%                  ao_in  = ao_matrix
+%
+% <a href="matlab:utils.helper.displayMethodInfo('ao', 'sin')">Parameters Description</a>
+%
+% VERSION:     $Id: sin.m,v 1.44 2011/04/19 18:48:11 ingo Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function varargout = sin(varargin)
+  
+  % Check if the method was called by another method
+  callerIsMethod = utils.helper.callerIsMethod;
+  
+  % Settings
+  operatorName = 'sin';
+  dxFcn = @(x,dx)abs(cos(x)).*dx;
+  
+  if callerIsMethod
+    in_names = {};
+  else
+    % Collect input variable names
+    in_names = cell(size(varargin));
+    for ii = 1:nargin,in_names{ii} = inputname(ii);end
+  end
+  
+  copyObjects = nargout>0;
+  [bs, pl] = ao.applymethod(copyObjects, callerIsMethod, in_names, operatorName, dxFcn, @getInfo, @getDefaultPlist, varargin{:});
+  
+  if isa(bs, 'ao')
+    % Set units
+    setUnitsForAxis(bs, pl, '');
+  end
+  
+  % set outputs
+  varargout = utils.helper.setoutputs(nargout, bs);
+  
+end
+
+%--------------------------------------------------------------------------
+% Get Info Object
+%--------------------------------------------------------------------------
+function ii = getInfo(varargin)
+  ii = minfo.getInfoAxis(mfilename, @getDefaultPlist, varargin);
+end
+
+%--------------------------------------------------------------------------
+% Get Default Plist
+%--------------------------------------------------------------------------
+
+function plout = getDefaultPlist(set)
+  persistent pl;
+  persistent lastset;
+  if ~exist('pl', 'var') || isempty(pl) || ~strcmp(lastset, set)
+    pl = buildplist(set);
+    lastset = set;
+  end
+  plout = pl;
+end
+
+function plout = buildplist(varargin)
+  plout = plist.getDefaultAxisPlist(varargin{:});
+end