Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dynare
dynare
Commits
03c6130e
Verified
Commit
03c6130e
authored
4 years ago
by
Sébastien Villemot
Browse files
Options
Downloads
Patches
Plain Diff
time-varying information set solver: restore oo_.{,exo_}steady_state at the end of the simulation
parent
0f300332
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/time_varying_information_set_solver.m
+12
-1
12 additions, 1 deletion
matlab/time_varying_information_set_solver.m
with
12 additions
and
1 deletion
matlab/time_varying_information_set_solver.m
+
12
−
1
View file @
03c6130e
...
...
@@ -9,6 +9,10 @@ if ~islogical(terminal_steady_state_as_guess_value)
error
(
'A boolean must be given as second argument'
)
end
if
~
isempty
(
ys0_
)
error
(
'Cannot be used in conjunction with endval'
)
end
periods
=
options_
.
periods
;
%% Read CSV file
...
...
@@ -50,6 +54,10 @@ end
endo_simul
=
[
repmat
(
oo_
.
steady_state
,
1
,
M_
.
maximum_lag
)
NaN
(
M_
.
endo_nbr
,
periods
+
M_
.
maximum_lead
)];
exo_simul
=
[
repmat
(
oo_
.
exo_steady_state
'
,
M_
.
maximum_lag
,
1
);
NaN
(
periods
+
M_
.
maximum_lead
,
M_
.
exo_nbr
)];
% Save initial steady state, for restoring it at the end
initial_steady_state
=
oo_
.
steady_state
;
initial_exo_steady_state
=
oo_
.
exo_steady_state
;
% Start main loop around informational periods
info_period
=
1
;
while
info_period
<=
periods
...
...
@@ -65,7 +73,7 @@ while info_period <= periods
oo_
.
endo_simul
(:,
M_
.
maximum_lag
+
(
1
:
periods
-
info_period
+
1
))
=
repmat
(
oo_
.
steady_state
,
1
,
periods
-
info_period
+
1
);
elseif
info_period
==
1
% Use initial steady state as guess value for first simulation if not using terminal steady state
oo_
.
endo_simul
(:,
M_
.
maximum_lag
+
(
1
:
periods
))
=
repmat
(
steady_state
_prev
,
1
,
periods
);
oo_
.
endo_simul
(:,
M_
.
maximum_lag
+
(
1
:
periods
))
=
repmat
(
initial_
steady_state
,
1
,
periods
);
end
oo_
.
endo_simul
(:,
end
-
M_
.
maximum_lead
+
1
:
end
)
=
repmat
(
oo_
.
steady_state
,
1
,
M_
.
maximum_lead
);
oo_
.
exo_simul
=
exo_simul
(
info_period
:
end
,
:);
...
...
@@ -91,4 +99,7 @@ options_.periods = periods;
oo_
.
endo_simul
=
endo_simul
;
oo_
.
exo_simul
=
exo_simul
;
oo_
.
steady_state
=
initial_steady_state
;
oo_
.
exo_steady_state
=
initial_exo_steady_state
;
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment