Home > classes > @ao > conj.m

conj

PURPOSE ^

CONJ overloads the conjugate operator for Analysis objects.

SYNOPSIS ^

function bs = conj(varargin)

DESCRIPTION ^

 CONJ overloads the conjugate operator for Analysis objects.
 
 M Hewitson 12-03-07

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function bs = conj(varargin)
0002 
0003 % CONJ overloads the conjugate operator for Analysis objects.
0004 %
0005 % M Hewitson 12-03-07
0006 %
0007 
0008 % capture input variable names
0009 invars = {};
0010 for j=1:nargin
0011   invars = [invars cellstr(inputname(j))];
0012 end
0013 
0014 ALGONAME = mfilename;
0015 VERSION  = '$Id: conj.html,v 1.1 2007/06/08 14:15:02 hewitson Exp $';
0016 
0017 as = [];
0018 for j=1:nargin
0019   a = varargin{j};
0020   if isa(a, 'ao')
0021     as  = [as a];
0022   end
0023 end
0024 
0025 %create empty plist
0026 pl = plist();
0027 
0028 bs = [];
0029 % go through analysis objects
0030 for j=1:length(as)  
0031   a = as(j);
0032 
0033   d = get(a, 'data');
0034   dinfo = whos('d');
0035   % Which data type do we have
0036   dtype = dinfo.class;
0037   switch dtype
0038     case 'tsdata'
0039       disp('* conjugate of tsdata object');
0040 
0041       % make a new tsdata object
0042       [h, ts] = single_operation(d, 'conj', pl);
0043       %ts = tsdata(conj(d.x), d.fs);
0044       ts = set(ts, 'name', sprintf('conj(%s)', d.name));
0045       ts = set(ts, 'xunits', d.xunits);
0046       ts = set(ts, 'yunits', d.yunits);
0047       ts = set(ts, 't0', d.t0);
0048 %       % make a new history object
0049 %       h = history(ALGONAME, VERSION, [], [a.hist]);
0050 %       h = set(h, 'invars', invars);
0051       % make output analysis object
0052       h = set(h, 'invars', [a.hist]);
0053       b = ao(ts, h);
0054       b = set(b, 'name', sprintf('conj(%s)', char(invars{1})));
0055 
0056     case 'fsdata'
0057       disp('* conjugate of fsdata object');
0058       % make a new fsdata object
0059       [h, fs] = single_operation(d, 'conj', pl);
0060       %fs = fsdata(d.f, conj(d.xx), d.fs);
0061       fs = set(fs, 'name', sprintf('conj(%s)', d.name));
0062       fs = set(fs, 'xunits', d.xunits);
0063       fs = set(fs, 'yunits', d.yunits);
0064       fs = set(fs, 'enbw', d.enbw);
0065 
0066 %       % make a new history object
0067 %       h = history(ALGONAME, VERSION, [], [a.hist]);
0068 %       h = set(h, 'invars', invars);
0069         h = set(h, 'invars', [a.hist]);
0070       % make output analysis object
0071       if isempty(char(invars{1}))
0072         n1 = a.name;
0073       else
0074         n1 = char(invars{1});
0075       end
0076       b = ao(fs, h);
0077       b = set(b, 'name', ['conj('  n1 ')'] );
0078     case 'cdata'
0079       disp('* conjugate of cdata object');
0080       % make a new cdata object
0081       [h, c] = single_operation(d, 'conj', pl);
0082       
0083       % make output analysis object
0084       h = set(h, 'invars', [a.hist]);
0085       b = ao(c, h);      
0086       b = set(b, 'name',  sprintf('conj(%s)', char(invars{1})));
0087     otherwise
0088       error('### unknown data type. They can not be addded.')
0089   end
0090 
0091   % add to output
0092   bs = [bs b];
0093 
0094 end
0095 % END

Generated on Fri 08-Jun-2007 16:09:11 by m2html © 2003