IMAG overloads the imaginary operator for Analysis objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: IMAG overloads the imaginary operator for Analysis objects. CALL: ao_out = imag(ao_in); ao_out = imag(ao_in, pl); 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 = imag(ao, 'Params') VERSION: $Id: imag.m,v 1.1 2007/08/20 15:27:48 ingo Exp $ HISTORY: 20-0802007 Diepholz Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function ao_out = imag(varargin) 0002 % IMAG overloads the imaginary operator for Analysis objects. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: IMAG overloads the imaginary operator for Analysis objects. 0007 % 0008 % CALL: ao_out = imag(ao_in); 0009 % ao_out = imag(ao_in, pl); 0010 % 0011 % POSSIBLE VALUES: ao_in = [ao2 ao3] 0012 % ao_in = ao_vector 0013 % ao_in = ao_matrix 0014 % 0015 % PARAMETER LIST: <key> <value> <description> 0016 % tsdata fsdata xydata 0017 % 'xdata' 't' 'f' 'x' compute the xdata 0018 % 'ydata' 'x' 'xx' 'y' compute the ydata 0019 % 0020 % The following call returns a parameter list object that contains the 0021 % default parameter values: 0022 % 0023 % >> pl = imag(ao, 'Params') 0024 % 0025 % VERSION: $Id: imag.m,v 1.1 2007/08/20 15:27:48 ingo Exp $ 0026 % 0027 % HISTORY: 20-0802007 Diepholz 0028 % Creation 0029 % 0030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0031 0032 ao_out = []; 0033 pl = []; 0034 0035 %% Check if this is a call for parameters 0036 if nargin == 2 0037 if isa(varargin{1}, 'ao') && ischar(varargin{2}) 0038 in = char(varargin{2}); 0039 if strcmp(in, 'Params') 0040 ao_out = getDefaultPL(); 0041 return 0042 end 0043 end 0044 end 0045 0046 %% store the input ao's in the vector: ao_set 0047 ao_set = []; 0048 for i=1:nargin 0049 a = varargin{i}; 0050 if isa(a, 'ao') 0051 0052 a = reshape(a, 1, []); 0053 ao_set = [ao_set a]; 0054 0055 elseif isa(varargin{i}, 'plist') 0056 pl = [pl varargin{i}]; 0057 end 0058 end 0059 0060 if ~isempty (pl) 0061 pl = combine(pl); 0062 end 0063 0064 %% go through analysis objects 0065 for j=1:length(ao_set) 0066 a = ao_set(j); 0067 0068 [h, imag_data] = single_operation(a.data, 'imag', pl); 0069 0070 %% Add the history from the ao object to the history 0071 h = set(h, 'inhists', [a.hist]); 0072 0073 %% Set the var_name to the history 0074 if (j <= nargin) 0075 if (isempty (inputname(j))) 0076 h = set(h, 'invars', cellstr('no var_name')); 0077 else 0078 h = set(h, 'invars', cellstr(inputname(j))); 0079 end 0080 else 0081 h = set(h, 'invars', cellstr('no var_name')); 0082 end 0083 0084 %% create a new analysis objects 0085 new_ao = a; 0086 new_ao = ao (imag_data, h); 0087 new_ao = set (new_ao, 'name', sprintf('imag(%s)',a.name) ); 0088 0089 ao_out = [ao_out new_ao]; 0090 0091 end 0092 0093 0094 0095 0096 0097 %% Get default params 0098 function pl_default = getDefaultPL() 0099 0100 disp('* creating default plist...'); 0101 pl_default = plist([param('xdata', '') 0102 param('ydata', '')]); 0103 disp('* done.'); 0104 0105 0106 % END