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.12 2007/11/26 14:48:13 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.12 2007/11/26 14:48:13 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.12 2007/11/26 14:48:13 ingo Exp $';
0025 bs      = [];
0026 
0027 if nargin == 2
0028   if isa(varargin{1}, 'ao') && ischar(varargin{2})
0029     in = char(varargin{2});
0030     if strcmp(in, 'Params')
0031       varargout{1} = getDefaultPL();
0032       return
0033     elseif strcmp(in, 'Version')
0034       varargout{1} = VERSION;
0035       return
0036     end
0037   end
0038 end
0039 
0040 %% Collect input ao's, plist's and ao variable names
0041 in_names = {};
0042 for ii = 1:nargin
0043   in_names{end+1} = inputname(ii);
0044 end
0045 
0046 [as, ps, invars] = collect_inputs(varargin, in_names);
0047 
0048 % check plist
0049 if isempty(ps)
0050   pl = getDefaultPL();
0051 else
0052   pl = combine(ps, getDefaultPL);
0053 end
0054 
0055 %% go through analysis objects
0056 for j=1:numel(as)
0057   a = as(j);
0058 
0059   [h, conj_data] = single_operation(a.data, 'conj', pl);
0060 
0061   %% Set the x, y-units to their old values (without abs())
0062   conj_data = set(conj_data, 'xunits', a.data.xunits);
0063   conj_data = set(conj_data, 'yunits', a.data.yunits);
0064   conj_data = set(conj_data, 'name', sprintf ('conj(%s)',a.data.name));
0065 
0066   %% Add the history from the ao object to the history
0067   h = set(h, 'inhists', [a.hist]);
0068 
0069   %% Set the var_name to the history
0070   h = set(h, 'invars', cellstr(invars{j}));
0071 
0072   %% create a new analysis objects
0073   new_ao = ao  (conj_data, h);
0074   new_ao = setnh(new_ao, 'name', sprintf('conj(%s)',invars{j}) );
0075 
0076   % add to output
0077   bs = [bs new_ao];
0078 
0079 end
0080 
0081 % Reshape the ouput to the same size of the input
0082 varargout{1} = reshape(bs, size(as));
0083 
0084 %% Get default params
0085 function plo = getDefaultPL()
0086 plo = plist();
0087 
0088 % END

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