Home > classes > @ao > sin.m

sin

PURPOSE ^

SIN overloads the sin operator for Analysis objects. Sine of argument in radians.

SYNOPSIS ^

function ao_out = sin (varargin)

DESCRIPTION ^

 SIN overloads the sin operator for Analysis objects. Sine of argument in radians.

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

 DESCRIPTION: SIN overloads the sin operator for Analysis objects.
              Sine of argument in radians.
              SIN(ao) is the sine of the elements of ao.data.

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

 VERSION: $Id: sin.m,v 1.17 2007/11/26 14:48:13 ingo Exp $

 HISTORY: 07-05-2007 Diepholz
             Creation

 SEE ALSO: ao/cos, ao/tan, ao/asin, acos, atan, Contents

 SEE: <a href="matlab: help ao/Contents;">HELP: All Analysis Object Functions:</a>
      <a href="matlab: helpwin ao/Contents;">DOC: All Analysis Object Functions:</a>

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function ao_out = sin (varargin)
0002 % SIN overloads the sin operator for Analysis objects. Sine of argument in radians.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: SIN overloads the sin operator for Analysis objects.
0007 %              Sine of argument in radians.
0008 %              SIN(ao) is the sine of the elements of ao.data.
0009 %
0010 % CALL: ao_out = sin(ao_in);
0011 %       ao_out = sin(ao_in, pl);
0012 %       ao_out = sin(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 = sin(ao, 'Params')
0027 %
0028 % VERSION: $Id: sin.m,v 1.17 2007/11/26 14:48:13 ingo Exp $
0029 %
0030 % HISTORY: 07-05-2007 Diepholz
0031 %             Creation
0032 %
0033 % SEE ALSO: ao/cos, ao/tan, ao/asin, acos, atan, Contents
0034 %
0035 % SEE: <a href="matlab: help ao/Contents;">HELP: All Analysis Object Functions:</a>
0036 %      <a href="matlab: helpwin ao/Contents;">DOC: All Analysis Object Functions:</a>
0037 %
0038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0039 
0040 VERSION  = '$Id: sin.m,v 1.17 2007/11/26 14:48:13 ingo Exp $';
0041 ao_out   = [];
0042 
0043 %% Check if this is a call for parameters
0044 if nargin == 2
0045   if isa(varargin{1}, 'ao') && ischar(varargin{2})
0046     in = char(varargin{2});
0047     if strcmp(in, 'Params')
0048       ao_out = getDefaultPL();
0049       return
0050     elseif strcmp(in, 'Version')
0051       ao_out = VERSION;
0052       return
0053     end
0054   end
0055 end
0056 
0057 %% Collect input ao's, plist's and ao variable names
0058 in_names = {};
0059 for ii = 1:nargin
0060   in_names{end+1} = inputname(ii);
0061 end
0062 
0063 [ao_set, pl, invars] = collect_inputs(varargin, in_names);
0064 
0065 if ~isempty (pl)
0066   pl = combine(pl);
0067 end
0068 
0069 %% go through analysis objects
0070 for j=1:numel(ao_set)
0071   a = ao_set(j);
0072 
0073   [h, sin_data] = single_operation(a.data, 'sin', pl);
0074 
0075   %% Add the history from the ao object to the history
0076   h = set(h, 'inhists', [a.hist]);
0077 
0078   %% Set the var_name to the history
0079   h = set(h, 'invars', cellstr(invars{j}));
0080 
0081   %% create a new analysis objects
0082   new_ao = ao  (sin_data, h);
0083   new_ao = setnh(new_ao, 'name', sprintf('sin(%s)',invars{j}) );
0084 
0085   ao_out = [ao_out new_ao];
0086 
0087 end
0088 
0089 % Reshape the ouput to the same size of the input
0090 ao_out = reshape(ao_out, size(ao_set));
0091 
0092 
0093 %% Get default params
0094 function pl_default = getDefaultPL()
0095 
0096   pl_default = plist([param('xdata',  '')
0097                       param('ydata',  '')]);
0098 
0099 
0100 % END

Generated on Tue 22-Jan-2008 10:39:13 by m2html © 2003