comparison m-toolbox/classes/@filterbank/resp.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % RESP Make a frequency response of a filterbank.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: RESP Make a frequency response of a filter bank.
5 % The input filter should be a filterbank object.
6 %
7 % The response is returned as a frequency-series in an
8 % analysis object.
9 %
10 % CALL: as = resp(filts1,filts2,...,pl)
11 % as = resp(filts,pl)
12 % as = filts.resp(pl)
13 %
14 % <a href="matlab:utils.helper.displayMethodInfo('filterbank', 'resp')">Parameters Description</a>
15 %
16 % INPUTS: filtsN - input filterbank objects
17 % filts - input filterbank objects array
18 % pl - input parameter list
19 %
20 % OUTPUTS: as - array of analysis objects, one for each input
21 %
22 % VERSION: $Id: resp.m,v 1.6 2011/04/08 08:56:20 hewitson Exp $
23 %
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25
26 function varargout = resp(varargin)
27
28 %%% Check if this is a call for parameters
29 if utils.helper.isinfocall(varargin{:})
30 varargout{1} = getInfo(varargin{3});
31 return
32 end
33
34 % Collect input variable names
35 in_names = cell(size(varargin));
36 for ii = 1:nargin,in_names{ii} = inputname(ii);end
37
38 %%% get input filter
39 [filts, filt_invars] = utils.helper.collect_objects(varargin(:), 'filterbank', in_names);
40 pl = utils.helper.collect_objects(varargin(:), 'plist', in_names);
41 if isempty(pl)
42 pl = plist;
43 end
44
45 cs = ao.initObjectWithSize(size(filts, 1), size(filts, 2));
46
47 % Go through each input AO
48 for jj = 1 : numel(filts)
49 % make output analysis object
50 cs(jj) = resp(filts(jj).filters, pl.pset('bank',filts(jj).type));
51 % set name
52 cs(jj).name = sprintf('resp(%s)', filt_invars{jj});
53 % Add history
54 cs(jj).addHistory(getInfo('None'), pl, filt_invars(jj), filts(jj).hist);
55 end
56
57 % Outputs
58 if nargout == 0
59 iplot(cs)
60 elseif nargout == numel(cs)
61 % List of outputs
62 for ii = 1:numel(filts)
63 varargout{ii} = cs(ii);
64 end
65 else
66 % Single output
67 varargout{1} = cs;
68 end
69 end
70
71 %--------------------------------------------------------------------------
72 % Get Info Object
73 %--------------------------------------------------------------------------
74 function ii = getInfo(varargin)
75
76 ii = ltpda_filter.getInfo('resp', varargin{:});
77 ii.setMclass('filterbank');
78 % The 'bank' parameter is overriden by the filterbank type
79 if ~strcmpi(varargin{1}, 'None')
80 ii.plists.remove('bank');
81 end
82 end
83
84
85