## [b37be7]: inst / @galois / filter.m  Maximize  Restore  History

### 89 lines (84 with data), 2.6 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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 ## Copyright (C) 2011 David Bateman ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn {Loadable Function} {y =} filter (@var{b}, @var{a}, @var{x}) ## @deftypefnx {Loadable Function} {[@var{y}, @var{sf}] =} filter (@var{b}, @var{a}, @var{x}, @var{si}) ## ## Digital filtering of vectors in a Galois Field. Returns the solution to ## the following linear, time-invariant difference equation over a Galois ## Field: ## @tex ## $$## \\sum_{k=0}^N a_{k+1} y_{n-k} = \\sum_{k=0}^M b_{k+1} x_{n-k}, \\qquad ## 1 \\le n \\le P ##$$ ## @end tex ## @ifnottex ## ## @smallexample ## @group ## N M ## SUM a(k+1) y(n-k) = SUM b(k+1) x(n-k) for 1<=n<=length(x) ## k=0 k=0 ## @end group ## @end smallexample ## @end ifnottex ## ## @noindent ## where ## @tex ## $a \\in \\Re^{N-1}$, $b \\in \\Re^{M-1}$, and $x \\in \\Re^P$. ## @end tex ## @ifnottex ## N=length(a)-1 and M=length(b)-1. ## @end ifnottex ## An equivalent form of this equation is: ## @tex ## $$## y_n = -\\sum_{k=1}^N c_{k+1} y_{n-k} + \\sum_{k=0}^M d_{k+1} x_{n-k}, \\qquad ## 1 \\le n \\le P ##$$ ## @end tex ## @ifnottex ## ## @smallexample ## @group ## N M ## y(n) = - SUM c(k+1) y(n-k) + SUM d(k+1) x(n-k) for 1<=n<=length(x) ## k=1 k=0 ## @end group ## @end smallexample ## @end ifnottex ## ## @noindent ## where ## @tex ## $c = a/a_1$ and $d = b/a_1$. ## @end tex ## @ifnottex ## c = a/a(1) and d = b/a(1). ## @end ifnottex ## ## If the fourth argument @var{si} is provided, it is taken as the ## initial state of the system and the final state is returned as ## @var{sf}. The state vector is a column vector whose length is ## equal to the length of the longest coefficient vector minus one. ## If @var{si} is not supplied, the initial state vector is set to all ## zeros. ## @end deftypefn function varargout = filter (varargin) varargout = cell (1, max (1, nargout)); [varargout{:}] = gfilter (varargin{:}); endfunction