1
function c=pfilt(f,g,varargin)
3
%@deftypefn {Function} pfilt
5
%PFILT Apply filter with periodic boundary conditions
9
% PFILT(f,g) applies the filter g to the input f. If f is a
10
% matrix, the filter is applied along each column.
12
% PFILT(f,g,a) does the same, but downsamples the output keeping only
13
% every a'th sample (starting with the first one).
15
% PFILT(f,g,a,dim) filters along dimension dim. The default value of
16
% [] means to filter along the first non-singleton dimension.
18
% The filter g can be a vector, in which case the vector is treated
19
% as a zero-delay FIR filter.
21
% The filter g can be a cell array. The following options are
24
% If the first element of the cell array is the name of one of the
25
% windows from FIRWIN, the whole cell array is passed onto
28
% If the first element of the cell array is 'bl', the rest of the
29
% cell array is passed onto BLFILTER.
31
% If the first element of the cell array is 'pgauss', 'psech',
32
% the rest of the parameters is passed onto the respective
33
% function. Note that you do not need to specify the length L.
35
% The coefficients obtained from filtering a signal f by a filter g are
39
% c(n+1) = sum f(l+1) * g(an-l+1)
42
% where an-l is computed modulo L.
45
%@strong{Url}: @url{http://ltfat.github.io/doc/sigproc/pfilt.html}
49
% Copyright (C) 2005-2015 Peter L. Soendergaard <peter@sonderport.dk>.
50
% This file is part of LTFAT version 2.1.0
52
% This program is free software: you can redistribute it and/or modify
53
% it under the terms of the GNU General Public License as published by
54
% the Free Software Foundation, either version 3 of the License, or
55
% (at your option) any later version.
57
% This program is distributed in the hope that it will be useful,
58
% but WITHOUT ANY WARRANTY; without even the implied warranty of
59
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
60
% GNU General Public License for more details.
62
% You should have received a copy of the GNU General Public License
63
% along with this program. If not, see <http://www.gnu.org/licenses/>.
66
% Assert correct input.
68
error('%s: Too few input parameters.',upper(mfilename));
71
definput.import={'pfilt'};
73
definput.keyvals.dim=[];
74
[flags,kv,a,dim]=ltfatarghelper({'a','dim'},definput,varargin);
76
[f,L,Ls,W,dim,permutedsize,order]=assert_sigreshape_pre(f,[],dim,upper(mfilename));
78
[g,info] = comp_fourierwindow(g,L,upper(mfilename));
81
outIsReal = isreal(f) &&...
82
(isfield(g,'h') && isreal(g.h) && ~(isfield(g,'fc') && g.fc~=0) || isfield(g,'H') && g.realonly);
84
g = comp_filterbank_pre({g},a,L,kv.crossover);
87
c = comp_filterbank(f,g,a);
90
permutedsize(1)=size(c,1);
92
c=assert_sigreshape_post(c,dim,permutedsize,order);