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.2 2007/10/09 14:05:25 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')

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

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.2 2007/10/09 14:05:25 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.2 2007/10/09 14:05:25 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     elseif strcmp(in, 'Version')
0046       ao_out = VERSION;
0047       return
0048     end
0049   end
0050 end
0051 
0052 %% store the input ao's in the vector: ao_set
0053 for i=1:nargin
0054   a = varargin{i};
0055   if isa(a, 'ao')
0056     ao_set  = [ao_set a];
0057   elseif isa(varargin{i}, 'plist')
0058     pl = [pl varargin{i}];
0059   end
0060 end
0061 
0062 
0063 %% capture input variable names
0064 invars = {};
0065 for j=1:nargin
0066   invars = [invars cellstr(inputname(j))];
0067 end
0068 
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, 'ltpda_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   if (j <= nargin)
0086     if (isempty (inputname(j)))
0087       h = set(h, 'invars', cellstr('no var_name'));
0088     else
0089       h = set(h, 'invars', cellstr(inputname(j)));
0090     end
0091   else
0092     h = set(h, 'invars', cellstr('no var_name'));
0093   end
0094 
0095   %% create a new analysis objects
0096   new_ao = a;
0097   new_ao = ao  (phase_data, h);
0098   new_ao = set (new_ao, 'name', sprintf('phase(%s)',a.name) );
0099 
0100   ao_out = [ao_out new_ao];
0101 
0102 end
0103 
0104 % Reshape the ouput to the same size of the input
0105 ao_out = reshape(ao_out, size(ao_set));
0106 
0107 
0108 %% Get default params
0109 function pl_default = getDefaultPL()
0110 
0111   pl_default = plist([param('xdata',  '')
0112                       param('ydata',  '')]);
0113 
0114 % END

Generated on Fri 02-Nov-2007 19:39:27 by m2html © 2003