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.5 2008/01/20 12:55:04 hewitson 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.5 2008/01/20 12:55:04 hewitson 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.5 2008/01/20 12:55:04 hewitson Exp $';
0033 ao_out   = [];
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     elseif strcmp(in, 'Version')
0043       ao_out = VERSION;
0044       return
0045     end
0046   end
0047 end
0048 
0049 %% Collect input ao's, plist's and ao variable names
0050 in_names = {};
0051 for ii = 1:nargin
0052   in_names{end+1} = inputname(ii);
0053 end
0054 
0055 [ao_set, pl, invars] = collect_inputs(varargin, in_names);
0056 
0057 %% go through analysis objects
0058 for j=1:numel(ao_set)
0059   a = ao_set(j);
0060 
0061   [h, phase_data] = single_operation(a.data, 'phase', pl);
0062 
0063   %% Set the x, y-units to their old values (without phase())
0064   phase_data = set(phase_data, 'xunits', a.data.xunits);
0065   phase_data = set(phase_data, 'yunits', a.data.yunits);
0066   phase_data = set(phase_data, 'name',   sprintf ('phase(%s)',a.data.name));
0067 
0068   %% Add the history from the ao object to the history
0069   h = set(h, 'inhists', [a.hist]);
0070 
0071   %% Set the var_name to the history
0072   h = set(h, 'invars', cellstr(invars{j}));
0073 
0074   %% create a new analysis objects
0075   new_ao = ao  (phase_data, h);
0076   new_ao = setnh(new_ao, 'name', sprintf('phase(%s)',invars{j}) );
0077 
0078   ao_out = [ao_out new_ao];
0079 
0080 end
0081 
0082 % Reshape the ouput to the same size of the input
0083 ao_out = reshape(ao_out, size(ao_set));
0084 
0085 
0086 %% Get default params
0087 function pl_default = getDefaultPL()
0088 
0089   pl_default = plist([param('xdata',  '')
0090                       param('ydata',  '')]);
0091 
0092 % END

Generated on Tue 22-Jan-2008 10:39:13 by m2html © 2003