PHASE overloads the ltpda_phase operator for Analysis objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: PHASE overloads the ltpda_phase operator for Analysis objects. CALL: ao_out = phase(ao_in); ao_out = phase(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 VERSION: $Id: phase.m,v 1.1 2007/08/22 11:07:37 ingo Exp $ HISTORY: 22-08-2007 M Hewitson Creation The following call returns a parameter list object that contains the default parameter values: >> pl = phase(ao, 'Params') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function ao_out = phase(varargin) 0002 % PHASE overloads the ltpda_phase operator for Analysis objects. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: PHASE overloads the ltpda_phase operator for Analysis objects. 0007 % 0008 % CALL: ao_out = phase(ao_in); 0009 % ao_out = phase(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 % VERSION: $Id: phase.m,v 1.1 2007/08/22 11:07:37 ingo Exp $ 0021 % 0022 % HISTORY: 22-08-2007 M Hewitson 0023 % Creation 0024 % 0025 % The following call returns a parameter list object that contains the 0026 % default parameter values: 0027 % 0028 % >> pl = phase(ao, 'Params') 0029 % 0030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0031 0032 VERSION = '$Id: phase.m,v 1.1 2007/08/22 11:07:37 ingo Exp $'; 0033 0034 ao_set = []; 0035 ao_out = []; 0036 pl = []; 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 end 0046 end 0047 end 0048 0049 %% store the input ao's in the vector: ao_set 0050 for i=1:nargin 0051 a = varargin{i}; 0052 if isa(a, 'ao') 0053 0054 a = reshape(a, 1, []); 0055 ao_set = [ao_set a]; 0056 0057 elseif isa(varargin{i}, 'plist') 0058 0059 pl = [pl varargin{i}]; 0060 0061 end 0062 end 0063 0064 0065 %% capture input variable names 0066 invars = {}; 0067 for j=1:nargin 0068 invars = [invars cellstr(inputname(j))]; 0069 end 0070 0071 0072 %% go through analysis objects 0073 for j=1:length(ao_set) 0074 a = ao_set(j); 0075 0076 [h, phase_data] = single_operation(a.data, 'ltpda_phase', pl); 0077 0078 %% Set the x, y-units to their old values (without phase()) 0079 phase_data = set(phase_data, 'xunits', a.data.xunits); 0080 phase_data = set(phase_data, 'yunits', a.data.yunits); 0081 phase_data = set(phase_data, 'name', sprintf ('phase(%s)',a.data.name)); 0082 0083 %% Add the history from the ao object to the history 0084 h = set(h, 'inhists', [a.hist]); 0085 0086 %% Set the var_name to the history 0087 if (j <= nargin) 0088 if (isempty (inputname(j))) 0089 h = set(h, 'invars', cellstr('no var_name')); 0090 else 0091 h = set(h, 'invars', cellstr(inputname(j))); 0092 end 0093 else 0094 h = set(h, 'invars', cellstr('no var_name')); 0095 end 0096 0097 %% create a new analysis objects 0098 new_ao = a; 0099 new_ao = ao (phase_data, h); 0100 new_ao = set (new_ao, 'name', sprintf('phase(%s)',a.name) ); 0101 0102 ao_out = [ao_out new_ao]; 0103 0104 end 0105 0106 %% Get default params 0107 function pl_default = getDefaultPL() 0108 0109 disp('* creating default plist...'); 0110 pl_default = plist([param('xdata', '') 0111 param('ydata', '')]); 0112 disp('* done.'); 0113 0114 % END