Home > classes > @ao > log.m

log

PURPOSE ^

LOG overloads the log operator for Analysis objects. Natural logarithm.

SYNOPSIS ^

function ao_out = log (varargin)

DESCRIPTION ^

 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);

 POSSIBLE VALUES: ao_in  = [ao2 ao3]
                  ao_in  = ao_vector
                  ao_in  = ao_matrix

 PARAMETER LIST:  <key>           <value>             <description>
                          tsdata  fsdata  xydata
                 'xdata'   't'     'f'      'x'     compute the xdata
                 'ydata'   'x'     'xx'     'y'     compute the ydata

 The following call returns a parameter list object that contains the
 default parameter values:

 >> pl = log(ao,'Params')

 HISTORY: 23-05-2007 Diepholz
             Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function ao_out = log (varargin)
0002 % LOG overloads the log operator for Analysis objects. Natural logarithm.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: LOG overloads the log operator for Analysis objects.
0007 %              Natural logarithm.
0008 %              LOG(ao) is the natural logarithm of the elements of ao.data.
0009 %
0010 % CALL: ao_out = log(ao_in);
0011 %       ao_out = log(ao_in, pl);
0012 %       ao_out = log(ao1, pl1, ao_vector, ao_matrix, pl2);
0013 %
0014 % POSSIBLE VALUES: ao_in  = [ao2 ao3]
0015 %                  ao_in  = ao_vector
0016 %                  ao_in  = ao_matrix
0017 %
0018 % PARAMETER LIST:  <key>           <value>             <description>
0019 %                          tsdata  fsdata  xydata
0020 %                 'xdata'   't'     'f'      'x'     compute the xdata
0021 %                 'ydata'   'x'     'xx'     'y'     compute the ydata
0022 %
0023 % The following call returns a parameter list object that contains the
0024 % default parameter values:
0025 %
0026 % >> pl = log(ao,'Params')
0027 %
0028 % HISTORY: 23-05-2007 Diepholz
0029 %             Creation
0030 %
0031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0032 
0033 ALGONAME = mfilename;
0034 VERSION  = '$Id: log.m,v 1.5 2007/06/22 08:32:49 ingo Exp $';
0035 ao_out   = [];
0036 pl       = [];
0037 option   = '';
0038 
0039 %% Check if this is a call for parameters
0040 if nargin == 2
0041   if isa(varargin{1}, 'ao') && ischar(varargin{2})
0042     in = char(varargin{2});
0043     if strcmp(in, 'Params')
0044       ao_out = getDefaultPL();
0045       return
0046     end
0047   end
0048 end
0049 
0050 %% store the input ao's in the vector: ao_set
0051 ao_set = [];
0052 for i=1:nargin
0053   a = varargin{i};
0054   if isa(a, 'ao')
0055     [m,n] = size(a);
0056     for i = 1:m
0057       for j = 1:n
0058         ao_set  = [ao_set a(i,j)];
0059       end
0060     end
0061   elseif isa(varargin{i}, 'plist')
0062     pl = [pl varargin{i}];
0063   end
0064 end
0065 
0066 if ~isempty (pl)
0067   pl = combine(pl);
0068 end
0069 
0070 %% go through analysis objects
0071 for j=1:length(ao_set)
0072   a = ao_set(j);
0073 
0074   [h, log_data] = single_operation(a.data, 'log', pl);
0075 
0076   %% Add the history from the ao object to the history
0077   h = set(h, 'inhists', [a.hist]);
0078 
0079   %% Set the var_name to the history
0080   if (j <= nargin)
0081     if (isempty (inputname(j)))
0082       h = set(h, 'invars', cellstr('no var_name'));
0083     else
0084       h = set(h, 'invars', cellstr(inputname(j)));
0085     end
0086   else
0087     h = set(h, 'invars', cellstr('no var_name'));
0088   end
0089 
0090   %% create a new analysis objects
0091   new_ao = a;
0092   new_ao = ao  (log_data, h);
0093   new_ao = set (new_ao, 'name', sprintf('log(%s)',a.name) );
0094 
0095   ao_out = [ao_out new_ao];
0096 
0097 end
0098 
0099 
0100 %% Get default params
0101 function pl_default = getDefaultPL()
0102 
0103 disp('* creating default plist...');
0104   pl_default = plist([param('xdata',  '')
0105                       param('ydata',  '')]);
0106 disp('* done.');
0107 
0108 % END

Generated on Mon 03-Sep-2007 12:12:34 by m2html © 2003