Home > classes > @ao > power.m

power

PURPOSE ^

POWER implements power operator for analysis objects.

SYNOPSIS ^

function b = power(varargin)

DESCRIPTION ^

 POWER implements power operator for analysis objects.

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

 DESCRIPTION: POWER implements power operator for analysis objects.
              computes b.^c where b is an analysis object and c is
              either another analysis object or a constant.

 CALL:        a = a1.^scalar

 VERSION:     $Id: power.m,v 1.7 2007/06/22 08:32:49 ingo Exp $

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

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

 HISTORY: 01-02-07 M Hewitson
             Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function b = power(varargin)
0002 % POWER implements power operator for analysis objects.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: POWER implements power operator for analysis objects.
0007 %              computes b.^c where b is an analysis object and c is
0008 %              either another analysis object or a constant.
0009 %
0010 % CALL:        a = a1.^scalar
0011 %
0012 % VERSION:     $Id: power.m,v 1.7 2007/06/22 08:32:49 ingo Exp $
0013 %
0014 % The following call returns a parameter list object that contains the
0015 % default parameter values:
0016 %
0017 % >> pl = power(ao, 'Params')
0018 %
0019 % HISTORY: 01-02-07 M Hewitson
0020 %             Creation
0021 %
0022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0023 
0024 %% Check if this is a call for parameters
0025 if nargin == 2
0026   if isa(varargin{1}, 'ao') && ischar(varargin{2})
0027     in = char(varargin{2});
0028     if strcmp(in, 'Params')
0029       b = getDefaultPL();
0030       return
0031     end
0032   end
0033 end
0034 
0035 %% capture input variable names
0036 invars = {};
0037 for j=1:nargin
0038   iname = inputname(j);
0039   if isempty(iname) & isnumeric(varargin{j})
0040     iname = num2str(varargin{j});
0041   elseif isempty(iname) & ischar(varargin{j})
0042     iname = varargin{j};
0043   end
0044   invars = [invars cellstr(iname)];
0045 end
0046 
0047 ALGONAME = mfilename;
0048 VERSION  = '$Id: power.m,v 1.7 2007/06/22 08:32:49 ingo Exp $';
0049 
0050 op = '.^';
0051 
0052 [a1,a2,do] = aooperate(varargin, op);
0053 
0054 %--------- create output AO
0055 
0056 % make a new history object
0057 h = history(ALGONAME, VERSION, [], [a1.hist a2.hist]);
0058 h = set(h, 'invars', invars);
0059 
0060 % get names for output
0061 if isempty(char(invars{1}))
0062   n1 = a1.name;
0063 else
0064   n1 = char(invars{1});
0065 end
0066 if isempty(char(invars{2}))
0067   n2 = a2.name;
0068 else
0069   n2 = char(invars{2});
0070 end
0071 
0072 % make output analysis object
0073 % op = op(2:end);
0074 b = ao(do, h);
0075 b = set(b, 'name', sprintf('%s %s %s', n1, op, n2));
0076 
0077 %% Get default params
0078 function pl_default = getDefaultPL()
0079 
0080 disp('* creating default plist...');
0081   pl_default = plist();
0082 disp('* done.');
0083 
0084 
0085 % END
0086

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