1
function gout=warpedblfilter(winname,fsupp,fc,fs,freqtoscale,scaletofreq,varargin)
3
%@deftypefn {Function} warpedblfilter
5
%WARPEDBLFILTER Construct a warped band-limited filter
6
% Usage: g=warpedblfilter(winname,fsupp,fc,fs,freqtoscale);
7
% g=warpedblfilter(winname,fsupp,fc,...);
10
% winname : Name of prototype.
11
% fsupp : Support length of the prototype (in scale units).
12
% fc : Centre frequency (in Hz).
14
% freqtoscale : Function handle to convert Hz to scale units
15
% scaletofreq : Function to convert scale units into Hz.
18
% g : Filter definition, see BLFILTER.
20
% WARPEDBLFILTER(winname,fsupp) constructs a band-limited filter that is
21
% warped on a given frequency scale. The parameter winname specifies the basic
22
% shape of the frequency response. The name must be one of the shapes
23
% accepted by FIRWIN. The support of the frequency response measured on
24
% the selected frequency scale is specified by fsupp, the centre
25
% frequency by fc and the scale by the function handle freqtoscale*
26
% of a function that converts Hz into the choosen scale.
28
% If one of the inputs is a vector, the output will be a cell array
29
% with one entry in the cell array for each element in the vector. If
30
% more input are vectors, they must have the same size and shape and the
31
% the filters will be generated by stepping through the vectors. This
32
% is a quick way to create filters for FILTERBANK and UFILTERBANK.
34
% WARPEDBLFILTER accepts the following optional parameters:
36
% 'complex' Make the filter complex valued if the centre frequency
37
% is non-zero.necessary. This is the default.
39
% 'real' Make the filter real-valued if the centre frequency
42
% 'delay',d Set the delay of the filter. Default value is zero.
44
% 'scal',s Scale the filter by the constant s. This can be
45
% useful to equalize channels in a filterbank.
47
% It is possible to normalize the transfer function of the filter by
48
% passing any of the flags from the NORMALIZE function. The default
49
% normalization is 'energy'.
51
% The filter can be used in the PFILT routine to filter a signal, or
52
% in can be placed in a cell-array for use with FILTERBANK or
55
% The output format is the same as that of BLFILTER.
58
%@strong{Url}: @url{http://ltfat.sourceforge.net/doc/fourier/warpedblfilter.php}
59
%@seealso{blfilter, firwin, pfilt, filterbank}
62
% Copyright (C) 2005-2014 Peter L. Soendergaard <soender@users.sourceforge.net>.
63
% This file is part of LTFAT version 2.0.1
65
% This program is free software: you can redistribute it and/or modify
66
% it under the terms of the GNU General Public License as published by
67
% the Free Software Foundation, either version 3 of the License, or
68
% (at your option) any later version.
70
% This program is distributed in the hope that it will be useful,
71
% but WITHOUT ANY WARRANTY; without even the implied warranty of
72
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
73
% GNU General Public License for more details.
75
% You should have received a copy of the GNU General Public License
76
% along with this program. If not, see <http://www.gnu.org/licenses/>.
78
% Define initial value for flags and key/value pairs.
79
definput.import={'normalize'};
80
definput.importdefaults={'energy'};
81
definput.keyvals.delay=0;
82
definput.keyvals.scal=1;
83
definput.flags.real={'complex','real'};
85
[flags,kv]=ltfatarghelper({},definput,varargin);
87
[fsupp,fc,kv.delay,kv.scal]=scalardistribute(fsupp,fc,kv.delay,kv.scal);
96
if flags.do_1 || flags.do_area
97
g.H=@(L) comp_warpedfreqresponse( winname,freqtoscale(fc(ii)), ...
98
fsupp(ii),fs,L,freqtoscale, ...
99
scaletofreq, flags.norm)*kv.scal(ii)*L;
102
if flags.do_2 || flags.do_energy
103
g.H=@(L) comp_warpedfreqresponse(winname,freqtoscale(fc(ii)), ...
104
fsupp(ii),fs,L,freqtoscale,scaletofreq, ...
105
flags.norm)*kv.scal(ii)*sqrt(L);
108
if flags.do_inf || flags.do_peak
109
g.H=@(L) comp_warpedfreqresponse(winname,freqtoscale(fc(ii)), ...
110
fsupp(ii),fs,L,freqtoscale,scaletofreq, ...
111
flags.norm)*kv.scal(ii);
114
g.foff=@(L) comp_warpedfoff(freqtoscale(fc(ii)),fsupp(ii),fs,L,scaletofreq);
115
g.realonly=flags.do_real;
116
g.delay=kv.delay(ii);