Home > classes > @ao > phase.m

phase

PURPOSE ^

PHASE overloads the ltpda_phase operator for Analysis objects.

SYNOPSIS ^

function ao_out = phase(varargin)

DESCRIPTION ^

 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.6 2008/02/12 09:29:24 mauro 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')

 The following call returns a string that contains the routine CVS version:

 >> version = phase(ao,'Version')

 The following call returns a string that contains the routine category:

 >> category = phase(ao,'Category')

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

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.6 2008/02/12 09:29:24 mauro 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 % The following call returns a string that contains the routine CVS version:
0031 %
0032 % >> version = phase(ao,'Version')
0033 %
0034 % The following call returns a string that contains the routine category:
0035 %
0036 % >> category = phase(ao,'Category')
0037 %
0038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0039 
0040 VERSION  = '$Id: phase.m,v 1.6 2008/02/12 09:29:24 mauro Exp $';
0041 CATEGORY = 'Operator';
0042 
0043 ao_out   = [];
0044 
0045 %% Check if this is a call for parameters
0046 if nargin == 2
0047   if isa(varargin{1}, 'ao') && ischar(varargin{2})
0048     in = char(varargin{2});
0049     if strcmp(in, 'Params')
0050       ao_out = getDefaultPL();
0051       return
0052     elseif strcmp(in, 'Version')
0053       ao_out = VERSION;
0054       return
0055     elseif strcmp(in, 'Category')
0056       ao_out = CATEGORY;
0057       return
0058     end
0059   end
0060 end
0061 
0062 %% Collect input ao's, plist's and ao variable names
0063 in_names = {};
0064 for ii = 1:nargin
0065   in_names{end+1} = inputname(ii);
0066 end
0067 
0068 [ao_set, pl, invars] = collect_inputs(varargin, in_names);
0069 
0070 %% go through analysis objects
0071 for j=1:numel(ao_set)
0072   a = ao_set(j);
0073 
0074   [h, phase_data] = single_operation(a.data, 'phase', pl);
0075 
0076   %% Set the x, y-units to their old values (without phase())
0077   phase_data = set(phase_data, 'xunits', a.data.xunits);
0078   phase_data = set(phase_data, 'yunits', a.data.yunits);
0079   phase_data = set(phase_data, 'name',   sprintf ('phase(%s)',a.data.name));
0080 
0081   %% Add the history from the ao object to the history
0082   h = set(h, 'inhists', [a.hist]);
0083 
0084   %% Set the var_name to the history
0085   h = set(h, 'invars', cellstr(invars{j}));
0086 
0087   %% create a new analysis objects
0088   new_ao = ao  (phase_data, h);
0089   new_ao = setnh(new_ao, 'name', sprintf('phase(%s)',invars{j}) );
0090 
0091   ao_out = [ao_out new_ao];
0092 
0093 end
0094 
0095 % Reshape the ouput to the same size of the input
0096 ao_out = reshape(ao_out, size(ao_set));
0097 
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 Mon 31-Mar-2008 13:54:54 by m2html © 2003