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.8 2007/06/22 08:32:49 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.8 2007/06/22 08:32:49 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 if nargin == 2
0025   if isa(varargin{1}, 'ao') && ischar(varargin{2})
0026     in = char(varargin{2});
0027     if strcmp(in, 'Params')
0028       varargout{1} = getDefaultPL();
0029       return
0030     end
0031   end
0032 end
0033 
0034 % capture input variable names
0035 invars = {};
0036 
0037 ALGONAME = mfilename;
0038 VERSION  = '$Id: conj.m,v 1.8 2007/06/22 08:32:49 ingo Exp $';
0039 
0040 as = [];
0041 bs = [];
0042 ps = [];
0043 
0044 for j=1:nargin
0045   invars = [invars cellstr(inputname(j))];
0046   if isa(varargin{j}, 'ao')
0047     as = [as varargin{j}];
0048   end
0049   if isa(varargin{j}, 'plist')
0050     ps = [ps varargin{j}];
0051   end
0052 end
0053 
0054 
0055 % check plist
0056 if isempty(ps)
0057   pl = getDefaultPL();
0058 else
0059   pl = combine(ps, getDefaultPL);
0060 end
0061 %% go through analysis objects
0062 for j=1:length(as)
0063   a = as(j);
0064 
0065   d = get(a, 'data');
0066   dinfo = whos('d');
0067   % Which data type do we have
0068   dtype = dinfo.class;
0069   switch dtype
0070     case 'tsdata'
0071       disp('* conjugate of tsdata object');
0072 
0073       % make a new tsdata object
0074       [h, ts] = single_operation(d, 'conj', pl);
0075       %ts = tsdata(conj(d.x), d.fs);
0076       ts = set(ts, 'name', sprintf('conj(%s)', d.name));
0077       ts = set(ts, 'xunits', d.xunits);
0078       ts = set(ts, 'yunits', d.yunits);
0079       ts = set(ts, 't0', d.t0);
0080 %       % make a new history object
0081 %       h = history(ALGONAME, VERSION, [], [a.hist]);
0082 %       h = set(h, 'invars', invars);
0083       % make output analysis object
0084       h = set(h, 'invars', [a.hist]);
0085       b = ao(ts, h);
0086       b = set(b, 'name', sprintf('conj(%s)', char(invars{1})));
0087 
0088     case 'fsdata'
0089       disp('* conjugate of fsdata object');
0090       % make a new fsdata object
0091       [h, fs] = single_operation(d, 'conj', pl);
0092       %fs = fsdata(d.f, conj(d.xx), d.fs);
0093       fs = set(fs, 'name', sprintf('conj(%s)', d.name));
0094       fs = set(fs, 'xunits', d.xunits);
0095       fs = set(fs, 'yunits', d.yunits);
0096       fs = set(fs, 'enbw', d.enbw);
0097 
0098 %       % make a new history object
0099 %       h = history(ALGONAME, VERSION, [], [a.hist]);
0100 %       h = set(h, 'invars', invars);
0101         h = set(h, 'invars', [a.hist]);
0102       % make output analysis object
0103       if isempty(char(invars{1}))
0104         n1 = a.name;
0105       else
0106         n1 = char(invars{1});
0107       end
0108       b = ao(fs, h);
0109       b = set(b, 'name', ['conj('  n1 ')'] );
0110     case 'cdata'
0111       disp('* conjugate of cdata object');
0112       % make a new cdata object
0113       [h, c] = single_operation(d, 'conj', pl);
0114 
0115       % make output analysis object
0116       h = set(h, 'invars', [a.hist]);
0117       b = ao(c, h);
0118       b = set(b, 'name',  sprintf('conj(%s)', char(invars{1})));
0119     otherwise
0120       error('### unknown data type. They can not be addded.')
0121   end
0122 
0123   % add to output
0124   bs = [bs b];
0125 
0126 end
0127 
0128 varargout{1} = bs;
0129 
0130 %% Get default params
0131 function plo = getDefaultPL()
0132 
0133 disp('* creating default plist...');
0134 plo = plist();
0135 disp('* done.');
0136 
0137 % END

Generated on Mon 03-Sep-2007 12:12:34 by m2html © 2003