Home > classes > @ao > conj.m

conj

PURPOSE ^

CONJ overloads the conjugate operator for Analysis objects.

SYNOPSIS ^

function varargout = conj(varargin)

DESCRIPTION ^

 CONJ overloads the conjugate operator for Analysis objects.

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

 DESCRIPTION: CONJ overloads the conjugate operator for Analysis objects.

 CALL:        a_conj = conj

 VERSION:     $Id: conj.m,v 1.9 2007/10/09 14:05:25 ingo Exp $

 The following call returns a parameter list object that contains the
 default parameter values:

 >> pl = conj(ao, 'Params')

 HISTORY: 12-03-07 M Hewitson
             Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = conj(varargin)
0002 % CONJ overloads the conjugate operator for Analysis objects.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: CONJ overloads the conjugate operator for Analysis objects.
0007 %
0008 % CALL:        a_conj = conj
0009 %
0010 % VERSION:     $Id: conj.m,v 1.9 2007/10/09 14:05:25 ingo Exp $
0011 %
0012 % The following call returns a parameter list object that contains the
0013 % default parameter values:
0014 %
0015 % >> pl = conj(ao, 'Params')
0016 %
0017 % HISTORY: 12-03-07 M Hewitson
0018 %             Creation
0019 %
0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0021 
0022 % Check if this is a call for parameters
0023 
0024 VERSION  = '$Id: conj.m,v 1.9 2007/10/09 14:05:25 ingo Exp $';
0025 
0026 invars = {};
0027 as     = [];
0028 bs     = [];
0029 ps     = [];
0030 
0031 if nargin == 2
0032   if isa(varargin{1}, 'ao') && ischar(varargin{2})
0033     in = char(varargin{2});
0034     if strcmp(in, 'Params')
0035       varargout{1} = getDefaultPL();
0036       return
0037     elseif strcmp(in, 'Version')
0038       varargout{1} = VERSION;
0039       return
0040     end
0041   end
0042 end
0043 
0044 % capture input variable names
0045 for j=1:nargin
0046   invars = [invars cellstr(inputname(j))];
0047   if isa(varargin{j}, 'ao')
0048     as = [as varargin{j}];
0049   end
0050   if isa(varargin{j}, 'plist')
0051     ps = [ps varargin{j}];
0052   end
0053 end
0054 
0055 % check plist
0056 if isempty(ps)
0057   pl = getDefaultPL();
0058 else
0059   pl = combine(ps, getDefaultPL);
0060 end
0061 
0062 %% go through analysis objects
0063 for j=1:numel(as)
0064   a = as(j);
0065 
0066   [h, conj_data] = single_operation(a.data, 'abs', pl);
0067 
0068   %% Set the x, y-units to their old values (without abs())
0069   conj_data = set(conj_data, 'xunits', a.data.xunits);
0070   conj_data = set(conj_data, 'yunits', a.data.yunits);
0071   %% It is nicer with the absolute signs | | than abs ()
0072   conj_data = set(conj_data, 'name', sprintf ('conj(%s)',a.data.name));
0073 
0074   %% Add the history from the ao object to the history
0075   h = set(h, 'inhists', [a.hist]);
0076 
0077   %% Set the var_name to the history
0078   if (j <= nargin)
0079     if (isempty (inputname(j)))
0080       h = set(h, 'invars', cellstr('no var_name'));
0081     else
0082       h = set(h, 'invars', cellstr(inputname(j)));
0083     end
0084   else
0085     h = set(h, 'invars', cellstr('no var_name'));
0086   end
0087 
0088   %% create a new analysis objects
0089   new_ao = ao  (conj_data, h);
0090   new_ao = set (new_ao, 'name', sprintf('conj(%s)',a.name) );
0091 
0092   % add to output
0093   bs = [bs new_ao];
0094 
0095 end
0096 
0097 % Reshape the ouput to the same size of the input
0098 varargout{1} = reshape(bs, size(as));
0099 
0100 %% Get default params
0101 function plo = getDefaultPL()
0102 plo = plist();
0103 
0104 % END

Generated on Thu 01-Nov-2007 09:42:34 by m2html © 2003