EXP overloads the exp operator for Analysis objects. Exponential. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: EXP overloads the exp operator for Analysis objects. Exponential. EXP(ao) is the exponential of the elements of ao.data e to the ao.data. CALL: ao_out = exp(ao_in); ao_out = exp(ao_in, pl); ao_out = exp(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 = exp(ao, 'Params') The following call returns a string that contains the routine CVS version: >> version = exp(ao,'Version') The following call returns a string that contains the routine category: >> category = exp(ao,'Category') HISTORY: 23-05-2007 Diepholz Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function ao_out = exp (varargin) 0002 % EXP overloads the exp operator for Analysis objects. Exponential. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: EXP overloads the exp operator for Analysis objects. Exponential. 0007 % EXP(ao) is the exponential of the elements of ao.data 0008 % e to the ao.data. 0009 % 0010 % CALL: ao_out = exp(ao_in); 0011 % ao_out = exp(ao_in, pl); 0012 % ao_out = exp(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 = exp(ao, 'Params') 0027 % 0028 % The following call returns a string that contains the routine CVS version: 0029 % 0030 % >> version = exp(ao,'Version') 0031 % 0032 % The following call returns a string that contains the routine category: 0033 % 0034 % >> category = exp(ao,'Category') 0035 % 0036 % HISTORY: 23-05-2007 Diepholz 0037 % Creation 0038 % 0039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0040 0041 VERSION = '$Id: exp.html,v 1.14 2008/03/31 10:27:34 hewitson Exp $'; 0042 CATEGORY = 'Operator'; 0043 0044 ao_out = []; 0045 0046 %% Check if this is a call for parameters 0047 if nargin == 2 0048 if isa(varargin{1}, 'ao') && ischar(varargin{2}) 0049 in = char(varargin{2}); 0050 if strcmp(in, 'Params') 0051 ao_out = getDefaultPL(); 0052 return 0053 elseif strcmp(in, 'Version') 0054 ao_out = VERSION; 0055 return 0056 elseif strcmp(in, 'Category') 0057 ao_out = CATEGORY; 0058 return 0059 end 0060 end 0061 end 0062 0063 %% Collect input ao's, plist's and ao variable names 0064 in_names = {}; 0065 for ii = 1:nargin 0066 in_names{end+1} = inputname(ii); 0067 end 0068 0069 [ao_set, pl, invars] = collect_inputs(varargin, in_names); 0070 0071 if ~isempty (pl) 0072 pl = combine(pl); 0073 end 0074 0075 %% go through analysis objects 0076 for j=1:numel(ao_set) 0077 a = ao_set(j); 0078 0079 [h, exp_data] = single_operation(a.data, 'exp', pl); 0080 0081 %% Add the history from the ao object to the history 0082 h = set(h, 'inhists', [a.hist]); 0083 0084 %% Set the var_name to the history 0085 h = set(h, 'invars', cellstr(invars{j})); 0086 0087 %% create a new analysis objects 0088 new_ao = a; 0089 new_ao = ao (exp_data, h); 0090 new_ao = setnh (new_ao, 'name', sprintf('exp(%s)',invars{j}) ); 0091 0092 ao_out = [ao_out new_ao]; 0093 0094 end 0095 0096 % Reshape the ouput to the same size of the input 0097 ao_out = reshape(ao_out, size(ao_set)); 0098 0099 %% Get default params 0100 function pl_default = getDefaultPL() 0101 0102 pl_default = plist([param('xdata', '') 0103 param('ydata', '')]); 0104 0105 0106 % END