## Copyright (C) 2009 Lyle Collins
## 
## 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 2 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, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

## recur

## Author: Lyle Collins
## Created: 2009-08-08

function Y = recur (a, b, x, x0, y0)
N = length(a);
M = length(b)-1;
n = length(x);
y = [y0 zeros(1, length(n))];
x = [x0 x];
a1= a(N:-1:1);
b1= b(M+1:-1:1);
for i=N+1:N+n,
  y(i)=a1*y(i-N:i-1)' + b1*x(i-N:i-N+M)';
endfor
Y = y(N+1:N+n);
endfunction
