diff --git a/matlab/agregate.m b/matlab/agregate.m index e52c5e8ff9784bc5c4bcbbade868e8bc2f366a28..0df7c27e2579f76e6c4e29ddbb8d6246cd40adec 100644 --- a/matlab/agregate.m +++ b/matlab/agregate.m @@ -19,7 +19,7 @@ function agregate(ofile, varargin) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. -MAX_NUMBER_OF_ELEMENTS = 1000; +MAX_NUMBER_OF_ELEMENTS = 10000; warning off MATLAB:subscripting:noSubscriptsSpecified @@ -107,6 +107,18 @@ for i=1:length(varargin) end xlist = xlist(1:xnum,:); +% Get parameter values. +calibration = ''; +for i=1:length(varargin) + fid = fopen(sprintf('%s/parameter-values.inc', varargin{i})); + cline = fgetl(fid); + while ischar(cline) + calibration = sprintf('%s\n%s', calibration, cline); + cline = fgetl(fid); + end + fclose(fid); +end + % Move the endogenous variables which are not LHS of an equation % into the set of exogenous variables. [~, i1] = intersect(elist(:,1), eqlist(:,1)); @@ -132,6 +144,8 @@ for i=1:length(plist) fprintf(fid, '\t%s\n', plist{i}); end fprintf(fid, ';\n\n'); +fprintf(fid, calibration); +fprintf(fid, '\n\n'); fprintf(fid, 'var\n'); for i=1:rows(elist) if isempty(elist{i,2}) diff --git a/matlab/cherrypick.m b/matlab/cherrypick.m index 467124c56a148a08d39586378334c769002729b1..992353a0a63bbdcdb18c26ac1ed346c3ae16cf88 100644 --- a/matlab/cherrypick.m +++ b/matlab/cherrypick.m @@ -168,6 +168,15 @@ fid = fopen(sprintf('%s/exogenous.inc', outfold), 'w'); printlistofvariables(fid, 'exo', xlist, M_); fclose(fid); +% Export parameter values +fid = fopen(sprintf('%s/parameter-values.inc', outfold), 'w'); +for i=1:length(plist) + id = strcmp(plist{i}, M_.param_names); + if any(id) + fprintf(fid, '%s = %s;\n', plist{i}, num2str(M_.params(id), 16)); + end +end +fclose(fid); function printlistofvariables(fid, kind, list, DynareModel) if isfield(DynareModel, sprintf('%s_partitions', kind)) diff --git a/tests/ecb/agregate/1/parameter-values.inc b/tests/ecb/agregate/1/parameter-values.inc new file mode 100644 index 0000000000000000000000000000000000000000..a9cd8ce5ac45f27ef51ce14473ef26142be3c144 --- /dev/null +++ b/tests/ecb/agregate/1/parameter-values.inc @@ -0,0 +1,7 @@ +a1 = .1; +b1 = .2; +c1 = .3; +d1 = .4; +e1 = .5; +f1 = .6; +g1 = .7; \ No newline at end of file diff --git a/tests/ecb/agregate/2/parameter-values.inc b/tests/ecb/agregate/2/parameter-values.inc new file mode 100644 index 0000000000000000000000000000000000000000..7eab0b0d9e98566aba39437cadce5761dd649b43 --- /dev/null +++ b/tests/ecb/agregate/2/parameter-values.inc @@ -0,0 +1,7 @@ +a2 = -.1; +b2 = -.2; +c2 = -.3; +d2 = -.4; +e2 = -.5; +f2 = -.6; +g2 = -.7; \ No newline at end of file