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.
 
 computes b.^c where b is an analysis object and c is either another 
 analysis object or a constant.
 
 M Hewitson 01-02-07

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function b = power(varargin)
0002 
0003 % POWER implements power operator for analysis objects.
0004 %
0005 % computes b.^c where b is an analysis object and c is either another
0006 % analysis object or a constant.
0007 %
0008 % M Hewitson 01-02-07
0009 %
0010 
0011 
0012 % capture input variable names
0013 invars = {};
0014 for j=1:nargin
0015   iname = inputname(j);
0016   if isempty(iname) & isnumeric(varargin{j})
0017     iname = num2str(varargin{j});
0018   elseif isempty(iname) & ischar(varargin{j})
0019     iname = varargin{j};
0020   end    
0021   invars = [invars cellstr(iname)];
0022 end
0023 
0024 ALGONAME = mfilename;
0025 VERSION  = '$Id: power.html,v 1.1 2007/06/08 14:15:03 hewitson Exp $';
0026 
0027 op = '.^';
0028 
0029 [a1,a2,do] = aooperate(varargin, op);
0030 
0031 %--------- create output AO
0032 
0033 % make a new history object
0034 h = history(ALGONAME, VERSION, [], [a1.hist a2.hist]);
0035 h = set(h, 'invars', invars);
0036 
0037 % get names for output
0038 if isempty(char(invars{1}))
0039   n1 = a1.name;
0040 else
0041   n1 = char(invars{1});
0042 end
0043 if isempty(char(invars{2}))
0044   n2 = a2.name;
0045 else
0046   n2 = char(invars{2});
0047 end
0048 
0049 % make output analysis object
0050 % op = op(2:end);
0051 b = ao(do, h);
0052 b = set(b, 'name', sprintf('%s%s%s', n1, op, n2));
0053 
0054 
0055 end
0056 % END

Generated on Fri 08-Jun-2007 16:09:11 by m2html © 2003