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') The following call returns a string that contains the routine CVS version: >> version = sin(ao,'Version') The following call returns a string that contains the routine category: >> category = sin(ao,'Category') VERSION: $Id: sin.m,v 1.19 2008/03/14 06:04:54 mauro 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> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 % The following call returns a string that contains the routine CVS version: 0029 % 0030 % >> version = sin(ao,'Version') 0031 % 0032 % The following call returns a string that contains the routine category: 0033 % 0034 % >> category = sin(ao,'Category') 0035 % 0036 % VERSION: $Id: sin.m,v 1.19 2008/03/14 06:04:54 mauro Exp $ 0037 % 0038 % HISTORY: 07-05-2007 Diepholz 0039 % Creation 0040 % 0041 % SEE ALSO: ao/cos, ao/tan, ao/asin, acos, atan, Contents 0042 % 0043 % SEE: <a href="matlab: help ao/Contents;">HELP: All Analysis Object Functions:</a> 0044 % <a href="matlab: helpwin ao/Contents;">DOC: All Analysis Object Functions:</a> 0045 % 0046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0047 0048 VERSION = '$Id: sin.m,v 1.19 2008/03/14 06:04:54 mauro Exp $'; 0049 CATEGORY = 'Trigonometry'; 0050 0051 ao_out = []; 0052 0053 %% Check if this is a call for parameters 0054 if nargin == 2 0055 if isa(varargin{1}, 'ao') && ischar(varargin{2}) 0056 in = char(varargin{2}); 0057 if strcmp(in, 'Params') 0058 ao_out = getDefaultPL(); 0059 return 0060 elseif strcmp(in, 'Version') 0061 ao_out = VERSION; 0062 return 0063 elseif strcmp(in, 'Category') 0064 ao_out = CATEGORY; 0065 return 0066 end 0067 end 0068 end 0069 0070 %% Collect input ao's, plist's and ao variable names 0071 in_names = {}; 0072 for ii = 1:nargin 0073 in_names{end+1} = inputname(ii); 0074 end 0075 0076 [ao_set, pl, invars] = collect_inputs(varargin, in_names); 0077 0078 if ~isempty (pl) 0079 pl = combine(pl); 0080 end 0081 0082 %% go through analysis objects 0083 for j=1:numel(ao_set) 0084 a = ao_set(j); 0085 0086 [h, sin_data] = single_operation(a.data, 'sin', pl); 0087 0088 %% Add the history from the ao object to the history 0089 h = set(h, 'inhists', [a.hist]); 0090 0091 %% Set the var_name to the history 0092 h = set(h, 'invars', cellstr(invars{j})); 0093 0094 %% create a new analysis objects 0095 new_ao = ao (sin_data, h); 0096 new_ao = setnh(new_ao, 'name', sprintf('sin(%s)',invars{j}) ); 0097 0098 ao_out = [ao_out new_ao]; 0099 0100 end 0101 0102 % Reshape the ouput to the same size of the input 0103 ao_out = reshape(ao_out, size(ao_set)); 0104 0105 0106 %% Get default params 0107 function pl_default = getDefaultPL() 0108 0109 pl_default = plist([param('xdata', '') 0110 param('ydata', '')]); 0111 0112 0113 % END