1function d = bksup1(c,ny,jcf,iyf,periods)
2% function d = bksup1(c,ny,jcf,iyf,periods)
3% Solves deterministic models recursively by backsubstitution for one lead/lag
4%
5% INPUTS
6%    ny:             number of endogenous variables
7%    jcf:            variables index forward
8%
9% OUTPUTS
10%    d:              vector of backsubstitution results
11%
12% SPECIAL REQUIREMENTS
13%    none
14
15% Copyright (C) 2003-2017 Dynare Team
16%
17% This file is part of Dynare.
18%
19% Dynare is free software: you can redistribute it and/or modify
20% it under the terms of the GNU General Public License as published by
21% the Free Software Foundation, either version 3 of the License, or
22% (at your option) any later version.
23%
24% Dynare is distributed in the hope that it will be useful,
25% but WITHOUT ANY WARRANTY; without even the implied warranty of
26% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27% GNU General Public License for more details.
28%
29% You should have received a copy of the GNU General Public License
30% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
31
32ir = [(periods-2)*ny+1:ny+(periods-2)*ny] ;
33irf = iyf+(periods-1)*ny ;
34icf = [1:size(iyf,2)] ;
35
36for i = 2:periods
37    c(ir,jcf) = c(ir,jcf)-c(ir,icf)*c(irf,jcf) ;
38    ir = ir-ny ;
39    irf = irf-ny ;
40end
41
42d = c(:,jcf) ;
43