Correctly set oo_.deterministic_simulation.status in sim1_purely_{backward,forward}.m.
parent
98357c4591
commit
0e204673fd
|
@ -1,7 +1,7 @@
|
||||||
function sim1_purely_backward()
|
function sim1_purely_backward()
|
||||||
% Performs deterministic simulation of a purely backward model
|
% Performs deterministic simulation of a purely backward model
|
||||||
|
|
||||||
% Copyright (C) 2012-2013 Dynare Team
|
% Copyright (C) 2012-2014 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -36,15 +36,22 @@ function sim1_purely_backward()
|
||||||
|
|
||||||
model_dynamic = str2func([M_.fname,'_dynamic']);
|
model_dynamic = str2func([M_.fname,'_dynamic']);
|
||||||
|
|
||||||
|
oo_.deterministic_simulation.status = 1;
|
||||||
|
|
||||||
for it = 2:options_.periods+1
|
for it = 2:options_.periods+1
|
||||||
yb = oo_.endo_simul(:,it-1); % Values at previous period, also used as guess value for current period
|
yb = oo_.endo_simul(:,it-1); % Values at previous period, also used as guess value for current period
|
||||||
yb1 = yb(iyb);
|
yb1 = yb(iyb);
|
||||||
|
|
||||||
tmp = solve1(model_dynamic, [yb1; yb], 1:M_.endo_nbr, nyb+1:nyb+ ...
|
[tmp, check] = solve1(model_dynamic, [yb1; yb], 1:M_.endo_nbr, nyb+1:nyb+ ...
|
||||||
M_.endo_nbr, 1, options_.gstep, ...
|
M_.endo_nbr, 1, options_.gstep, ...
|
||||||
options_.solve_tolf,options_.solve_tolx, ...
|
options_.solve_tolf,options_.solve_tolx, ...
|
||||||
options_.simul.maxit,options_.debug,oo_.exo_simul, ...
|
options_.simul.maxit,options_.debug,oo_.exo_simul, ...
|
||||||
M_.params, oo_.steady_state, it);
|
M_.params, oo_.steady_state, it);
|
||||||
|
|
||||||
|
if info
|
||||||
|
oo_.deterministic_simulation.status = 0;
|
||||||
|
end
|
||||||
|
|
||||||
oo_.endo_simul(:,it) = tmp(nyb+1:nyb+M_.endo_nbr);
|
oo_.endo_simul(:,it) = tmp(nyb+1:nyb+M_.endo_nbr);
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
function sim1_purely_forward()
|
function sim1_purely_forward()
|
||||||
% Performs deterministic simulation of a purely forward model
|
% Performs deterministic simulation of a purely forward model
|
||||||
|
|
||||||
% Copyright (C) 2012 Dynare Team
|
% Copyright (C) 2012-2014 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -29,15 +29,22 @@ function sim1_purely_forward()
|
||||||
|
|
||||||
model_dynamic = str2func([M_.fname,'_dynamic']);
|
model_dynamic = str2func([M_.fname,'_dynamic']);
|
||||||
|
|
||||||
|
oo_.deterministic_simulation.status = 1;
|
||||||
|
|
||||||
for it = options_.periods:-1:1
|
for it = options_.periods:-1:1
|
||||||
yf = oo_.endo_simul(:,it+1); % Values at next period, also used as guess value for current period
|
yf = oo_.endo_simul(:,it+1); % Values at next period, also used as guess value for current period
|
||||||
yf1 = yf(iyf);
|
yf1 = yf(iyf);
|
||||||
|
|
||||||
tmp = solve1(model_dynamic, [yf; yf1], 1:M_.endo_nbr, 1:M_.endo_nbr, ...
|
[tmp, info] = solve1(model_dynamic, [yf; yf1], 1:M_.endo_nbr, 1:M_.endo_nbr, ...
|
||||||
1, options_.gstep, options_.solve_tolf, ...
|
1, options_.gstep, options_.solve_tolf, ...
|
||||||
options_.solve_tolx, options_.simul.maxit, ...
|
options_.solve_tolx, options_.simul.maxit, ...
|
||||||
options_.debug,oo_.exo_simul, M_.params, oo_.steady_state, ...
|
options_.debug,oo_.exo_simul, M_.params, oo_.steady_state, ...
|
||||||
it);
|
it);
|
||||||
|
|
||||||
|
if info
|
||||||
|
oo_.deterministic_simulation.status = 0;
|
||||||
|
end
|
||||||
|
|
||||||
oo_.endo_simul(:,it) = tmp(1:M_.endo_nbr);
|
oo_.endo_simul(:,it) = tmp(1:M_.endo_nbr);
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue