LOG overloads the log operator for Analysis objects. Natural logarithm. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: LOG overloads the log operator for Analysis objects. Natural logarithm. LOG(ao) is the natural logarithm of the elements of ao.data. CALL: ao_out = log(ao_in); ao_out = log(ao_in, pl); ao_out = log(ao1, pl1, ao_vector, ao_matrix, pl2); PARAMETERS: see help for data2D/applymethod for additional parameters M-FILE INFO: Get information about this methods by calling >> ao.getInfo('log') Get information about a specified set-plist by calling: >> ao.getInfo('log', 'None') VERSION: $Id: log.m,v 1.22 2008/09/05 14:11:47 hewitson Exp $ HISTORY: 23-05-2007 Diepholz Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % LOG overloads the log operator for Analysis objects. Natural logarithm. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: LOG overloads the log operator for Analysis objects. 0005 % Natural logarithm. 0006 % LOG(ao) is the natural logarithm of the elements of ao.data. 0007 % 0008 % CALL: ao_out = log(ao_in); 0009 % ao_out = log(ao_in, pl); 0010 % ao_out = log(ao1, pl1, ao_vector, ao_matrix, pl2); 0011 % 0012 % PARAMETERS: see help for data2D/applymethod for additional parameters 0013 % 0014 % M-FILE INFO: Get information about this methods by calling 0015 % >> ao.getInfo('log') 0016 % 0017 % Get information about a specified set-plist by calling: 0018 % >> ao.getInfo('log', 'None') 0019 % 0020 % VERSION: $Id: log.m,v 1.22 2008/09/05 14:11:47 hewitson Exp $ 0021 % 0022 % HISTORY: 23-05-2007 Diepholz 0023 % Creation 0024 % 0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0026 0027 function varargout = log (varargin) 0028 0029 import utils.const.* 0030 0031 % Check if this is a call for parameters 0032 if utils.helper.isinfocall(varargin{:}) 0033 varargout{1} = getInfo(varargin{3}); 0034 return 0035 end 0036 0037 utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename); 0038 0039 % Collect input variable names 0040 in_names = cell(size(varargin)); 0041 for ii = 1:nargin,in_names{ii} = inputname(ii);end 0042 0043 % Collect all AOs 0044 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names); 0045 pl = utils.helper.collect_objects(varargin(:), 'plist', in_names); 0046 0047 % Decide on a deep copy or a modify 0048 bs = copy(as, nargout); 0049 0050 % Combine plists 0051 pl = combine(pl, getDefaultPlist); 0052 0053 % Apply method to all AOs 0054 applymethod(bs, ao_invars, 'log', pl, getDefaultPlist, getInfo); 0055 0056 % Set units 0057 % for ii =1:numel(bs) 0058 % app_axis = pl.find('axis'); 0059 % if ~isempty(find('X'==upper(app_axis), 1)) 0060 % bs(ii).setXunits(feval('log', bs(ii).data.xunits), 'internal'); 0061 % end 0062 % if ~isempty(find('Y'==upper(app_axis), 1)) 0063 % bs(ii).setYunits(feval('log', bs(ii).data.yunits), 'internal'); 0064 % end 0065 % end 0066 0067 % Reshape the ouput to the same size of the input 0068 if nargout > 0 0069 varargout{1} = bs; 0070 end 0071 end 0072 0073 %-------------------------------------------------------------------------- 0074 % Get Info Object 0075 %-------------------------------------------------------------------------- 0076 function ii = getInfo(varargin) 0077 if nargin == 1 && strcmpi(varargin{1}, 'None') 0078 sets = {}; 0079 pl = []; 0080 else 0081 sets = {'Default'}; 0082 pl = getDefaultPlist; 0083 end 0084 % Build info object 0085 ii = minfo(mfilename, 'ao', '', utils.const.categories.op, '$Id: log.m,v 1.22 2008/09/05 14:11:47 hewitson Exp $', sets, pl); 0086 end 0087 0088 %-------------------------------------------------------------------------- 0089 % Get Default Plist 0090 %-------------------------------------------------------------------------- 0091 function pl_default = getDefaultPlist() 0092 pl_default = plist('axis', 'y'); 0093 end 0094