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