CONV vector convolution. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: CONV vector convolution. CALL: >> c = conv(a,b) INPUTS: pl - a parameter list a,b - input analysis object OUTPUTS: c - output analysis object containing the filtered data. M-FILE INFO: Get information about this methods by calling >> ao.getInfo('conv') Get information about a specified set-plist by calling: >> ao.getInfo('conv', 'None') VERSION: $Id: conv.m,v 1.1 2008/08/21 09:01:03 hewitson Exp $ HISTORY: 11-02-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % CONV vector convolution. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: CONV vector convolution. 0005 % 0006 % CALL: >> c = conv(a,b) 0007 % 0008 % INPUTS: pl - a parameter list 0009 % a,b - input analysis object 0010 % 0011 % OUTPUTS: 0012 % c - output analysis object containing the filtered data. 0013 % 0014 % 0015 % M-FILE INFO: Get information about this methods by calling 0016 % >> ao.getInfo('conv') 0017 % 0018 % Get information about a specified set-plist by calling: 0019 % >> ao.getInfo('conv', 'None') 0020 % 0021 % VERSION: $Id: conv.m,v 1.1 2008/08/21 09:01:03 hewitson Exp $ 0022 % 0023 % HISTORY: 11-02-07 M Hewitson 0024 % Creation 0025 % 0026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0027 0028 function varargout = conv(varargin) 0029 0030 % Check if this is a call for parameters 0031 if utils.helper.isinfocall(varargin{:}) 0032 varargout{1} = getInfo(varargin{3}); 0033 return 0034 end 0035 0036 import utils.const.* 0037 utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename); 0038 0039 % Collect input variable names 0040 in_names = cell(size(varargin)); 0041 for ii = 1:nargin,in_names{ii} = inputname(ii);end 0042 0043 % Collect all AOs and plists 0044 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names); 0045 0046 if nargout == 0 0047 error('### cohere cannot be used as a modifier. Please give an output variable.'); 0048 end 0049 0050 if numel(as) < 2 0051 error('### conv requires at least two input AOs to work.'); 0052 end 0053 0054 % Convolute the data 0055 name = ao_invars{1}; 0056 res = as(1).data.y; 0057 for j=2:numel(as) 0058 res = conv(res, as(j).data.y); 0059 name = sprintf('%s,%s', name, ao_invars{j}); 0060 end 0061 0062 % Make new AO 0063 bs = ao(res); 0064 % add history 0065 bs.addHistory(getInfo, getDefaultPlist, ao_invars, [as(:).hist]); 0066 % name for this object 0067 bs.setName(sprintf('conv(%s)', name), 'internal'); 0068 0069 % Set outputs 0070 if nargout == 1 0071 varargout{1} = bs; 0072 else 0073 error('### wrong number of output arguments.'); 0074 end 0075 end 0076 0077 %-------------------------------------------------------------------------- 0078 % Get Info Object 0079 %-------------------------------------------------------------------------- 0080 function ii = getInfo(varargin) 0081 if nargin == 1 && strcmpi(varargin{1}, 'None') 0082 sets = {}; 0083 pls = []; 0084 else 0085 sets = {'Default'}; 0086 pls = getDefaultPlist; 0087 end 0088 % Build info object 0089 ii = minfo(mfilename, 'ao', '', 'Signal Processing', '$Id: conv.m,v 1.1 2008/08/21 09:01:03 hewitson Exp $', sets, pls); 0090 end 0091 0092 %-------------------------------------------------------------------------- 0093 % Get Default Plist 0094 %-------------------------------------------------------------------------- 0095 function pl_default = getDefaultPlist() 0096 pl_default = plist(); 0097 end 0098