1function [endogenousvariables, info] = sim1_purely_forward(endogenousvariables, exogenousvariables, steadystate, M, options) 2% Performs deterministic simulation of a purely forward model 3 4% Copyright (C) 2012-2017 Dynare Team 5% 6% This file is part of Dynare. 7% 8% Dynare is free software: you can redistribute it and/or modify 9% it under the terms of the GNU General Public License as published by 10% the Free Software Foundation, either version 3 of the License, or 11% (at your option) any later version. 12% 13% Dynare is distributed in the hope that it will be useful, 14% but WITHOUT ANY WARRANTY; without even the implied warranty of 15% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16% GNU General Public License for more details. 17% 18% You should have received a copy of the GNU General Public License 19% along with Dynare. If not, see <http://www.gnu.org/licenses/>. 20 21ny0 = nnz(M.lead_lag_incidence(1,:)); % Number of variables at current period 22iyf = find(M.lead_lag_incidence(2,:)>0); % Indices of variables at next period 23 24if ny0 ~= M.endo_nbr 25 error('All endogenous variables must appear at the current period!') 26end 27 28dynamicmodel = str2func([M.fname,'.dynamic']); 29 30info.status = 1; 31 32for it = options.periods:-1:1 33 yf = endogenousvariables(:,it+1); % Values at next period, also used as guess value for current period 34 yf1 = yf(iyf); 35 [tmp, check] = solve1(dynamicmodel, [yf; yf1], 1:M.endo_nbr, 1:M.endo_nbr, ... 36 1, options.gstep, options.dynatol.f, ... 37 options.dynatol.x, options.simul.maxit, ... 38 options.debug, exogenousvariables, M.params, steadystate, ... 39 it+M.maximum_lag); 40 if check 41 info.status = 0; 42 end 43 endogenousvariables(:,it) = tmp(1:M.endo_nbr); 44end 45