Home > classes > @ao > acos.m

acos

PURPOSE ^

ACOS overloads the acos operator for Analysis objects. Inverse cosine result in radians.

SYNOPSIS ^

function ao_out = acos (varargin)

DESCRIPTION ^

 ACOS overloads the acos operator for Analysis objects. Inverse cosine result in radians.

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

 DESCRIPTION: ACOS overloads the acos operator for Analysis objects.
              Inverse cosine result in radians.
              ACOS(ao) is the cosine of the elements of ao.data.

 CALL: ao_out = acos(ao_in);
       ao_out = acos(ao_in, pl);
       ao_out = acos(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 = acos(ao, 'Params')

 HISTORY: 07-05-2007 Diepholz
             Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function ao_out = acos (varargin)
0002 % ACOS overloads the acos operator for Analysis objects. Inverse cosine result in radians.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: ACOS overloads the acos operator for Analysis objects.
0007 %              Inverse cosine result in radians.
0008 %              ACOS(ao) is the cosine of the elements of ao.data.
0009 %
0010 % CALL: ao_out = acos(ao_in);
0011 %       ao_out = acos(ao_in, pl);
0012 %       ao_out = acos(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 = acos(ao, 'Params')
0027 %
0028 % HISTORY: 07-05-2007 Diepholz
0029 %             Creation
0030 %
0031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0032 
0033 VERSION  = '$Id: acos.m,v 1.6 2007/09/27 09:03:25 ingo Exp $';
0034 ao_out   = [];
0035 pl       = [];
0036 option   = '';
0037 
0038 %% Check if this is a call for parameters
0039 if nargin == 2
0040   if isa(varargin{1}, 'ao') && ischar(varargin{2})
0041     in = char(varargin{2});
0042     if strcmp(in, 'Params')
0043       ao_out = getDefaultPL();
0044       return
0045     elseif strcmp(in, 'Version')
0046       ao_out = VERSION;
0047       return
0048     end
0049   end
0050 end
0051 
0052 %% store the input ao's in the vector: ao_set
0053 ao_set = [];
0054 for i=1:nargin
0055   a = varargin{i};
0056   if isa(a, 'ao')
0057     ao_set  = [ao_set a];
0058   elseif isa(varargin{i}, 'plist')
0059     pl = [pl varargin{i}];
0060   end
0061 end
0062 
0063 if ~isempty (pl)
0064   pl = combine(pl);
0065 end
0066 
0067 %% go through analysis objects
0068 for j=1:numel(ao_set)
0069   a = ao_set(j);
0070 
0071   [h, acos_data] = single_operation(a.data, 'acos', pl);
0072 
0073   %% Add the history from the ao object to the history
0074   h = set(h, 'inhists', [a.hist]);
0075 
0076   %% Set the var_name to the history
0077   if (j <= nargin)
0078     if (isempty (inputname(j)))
0079       h = set(h, 'invars', cellstr('no var_name'));
0080     else
0081       h = set(h, 'invars', cellstr(inputname(j)));
0082     end
0083   else
0084     h = set(h, 'invars', cellstr('no var_name'));
0085   end
0086 
0087   %% create a new analysis objects
0088   new_ao = a;
0089   new_ao = ao  (acos_data, h);
0090   new_ao = set (new_ao, 'name', sprintf('acos(%s)',a.name) );
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 % END

Generated on Thu 01-Nov-2007 09:42:34 by m2html © 2003