Home > classes > @ao > mpower.m

mpower

PURPOSE ^

MPOWER implements power operator for analysis objects.

SYNOPSIS ^

function b = mpower(varargin)

DESCRIPTION ^

 MPOWER 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 = mpower(varargin)
0002 
0003 % MPOWER 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 
0013 % capture input variable names
0014 invars = {};
0015 for j=1:nargin
0016   iname = inputname(j);
0017   if isempty(iname) & isnumeric(varargin{j})
0018     iname = num2str(varargin{j});
0019   elseif isempty(iname) & ischar(varargin{j})
0020     iname = varargin{j};
0021   end    
0022   invars = [invars cellstr(iname)];
0023 end
0024 
0025 ALGONAME = mfilename;
0026 VERSION  = '$Id: mpower.html,v 1.1 2007/06/08 14:15:02 hewitson Exp $';
0027 
0028 op = '^';
0029 
0030 [a1,a2,do] = aooperate(varargin, op);
0031 
0032 %--------- create output AO
0033 
0034 % make a new history object
0035 h = history(ALGONAME, VERSION, [], [a1.hist a2.hist]);
0036 h = set(h, 'invars', invars);
0037 
0038 % get names for output
0039 if isempty(char(invars{1}))
0040   n1 = a1.name;
0041 else
0042   n1 = char(invars{1});
0043 end
0044 if isempty(char(invars{2}))
0045   n2 = a2.name;
0046 else
0047   n2 = char(invars{2});
0048 end
0049 
0050 % make output analysis object
0051 % op = op(2:end);
0052 b = ao(do, h);
0053 b = set(b, 'name', sprintf('%s%s%s', n1, op, n2));
0054 
0055 
0056 end
0057 
0058 
0059 % END

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