1 ## Copyright (C) 2011 David Bateman
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
17 ## @deftypefn {Loadable Function} {y =} filter (@var{b}, @var{a}, @var{x})
18 ## @deftypefnx {Loadable Function} {[@var{y}, @var{sf}] =} filter (@var{b}, @var{a}, @var{x}, @var{si})
20 ## Digital filtering of vectors in a Galois Field. Returns the solution to
21 ## the following linear, time-invariant difference equation over a Galois
26 ## \\sum_{k=0}^N a_{k+1} y_{n-k} = \\sum_{k=0}^M b_{k+1} x_{n-k}, \\qquad
35 ## SUM a(k+1) y(n-k) = SUM b(k+1) x(n-k) for 1<=n<=length(x)
43 ## N=length(a)-1 and M=length(b)-1.
47 ## $a \\in \\Re^{N-1}$, $b \\in \\Re^{M-1}$, and $x \\in \\Re^P$.
50 ## An equivalent form of this equation is:
54 ## y_n = -\\sum_{k=1}^N c_{k+1} y_{n-k} + \\sum_{k=0}^M d_{k+1} x_{n-k}, \\qquad
63 ## y(n) = - SUM c(k+1) y(n-k) + SUM d(k+1) x(n-k) for 1<=n<=length(x)
71 ## c = a/a(1) and d = b/a(1).
75 ## $c = a/a_1$ and $d = b/a_1$.
79 ## If the fourth argument @var{si} is provided, it is taken as the
80 ## initial state of the system and the final state is returned as
81 ## @var{sf}. The state vector is a column vector whose length is
82 ## equal to the length of the longest coefficient vector minus one.
83 ## If @var{si} is not supplied, the initial state vector is set to all
87 function varargout = filter (varargin)
88 varargout = cell (1, max(1, nargout));
89 [varargout{:}] = gfilter (varargin{:});