## [191c94]: filterbank / filterbankresponse.m  Maximize  Restore  History

### 64 lines (57 with data), 2.1 kB

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63``` ```function gf=filterbankresponse(g,a,L,varargin) %FILTERBANKRESPONSE Response of filterbank as function of frequency % Usage: gf=filterbankresponse(g,a,L); % % `filterbankresponse(g,a,L)` computes the total response in frequency of % a filterbank specified by *g* and *a* for a signal length of % *L*. This corresponds to summing up all channels. The output is a % usefull tool to investigate the behaviour of the windows, as peaks % indicate that a frequency is overrepresented in the filterbank, while % a dip indicates that it is not well represented. % % In mathematical terms, this function computes the diagonal of the % Fourier transform of the frame operator when the filterbank is painless. % % `filterbankresponse(g,a,L,'real')` does the same for a filterbank % intended for positive-only filterbank. % % `filterbankresponse(g,a,L,fs)` specifies the sampling rate *fs*. This % is only used for plotting purposes. % % `filterbankresponse` takes the following optional parameters: % % 'fs',fs Sampling rate, used only for plotting. % % 'complex' Assume that the filters cover the entire frequency % range. This is the default. % % 'real' Assume that the filters only cover the positive % frequencies (and is intended to work with real-valued % signals only). % % 'noplot' Don't plot the response, just return it. % % 'plot' Plot the response using |plotfftreal|. % % See also: filterbank, filterbankbounds definput.flags.ctype={'complex','real'}; definput.flags.plottype={'noplot','plot'}; definput.flags.type={'total','individual'}; definput.keyvals.fs=[]; [flags,kv,fs]=ltfatarghelper({'fs'},definput,varargin); [g,info]=filterbankwin(g,a,L,'normal'); M=info.M; gf = zeros(L,M); for m=1:M gf(:,m) = comp_filterbankresponse(g(m),info.a(m),L,flags.do_real); end if flags.do_total gf = sum(gf,2); end if flags.do_plot if flags.do_real plotfftreal(gf(1:floor(L/2)+1),fs,'lin'); else plotfft(gf,fs,'lin'); end; end; ```