diff --git a/matlab/@dynDates/dynDates2decimal.m b/matlab/@dynDates/dynDates2decimal.m new file mode 100644 index 0000000000000000000000000000000000000000..6d36cc1f66d02e6aae26e0787b4cc3a5c8a7ca6f --- /dev/null +++ b/matlab/@dynDates/dynDates2decimal.m @@ -0,0 +1,23 @@ +function y = dynDates2decimal(dd) +% function y = dynDates2decimal(dd) +% returns a vector of doubles with the fractional part corresponding +% to the subperiod. Mostly used for plots. + +% Copyright (C) 2013 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <http://www.gnu.org/licenses/>. + + y = dd.time(:,1)+(dd.time(:,2)-1)/dd.freq; \ No newline at end of file diff --git a/matlab/@dynSeries/align.m b/matlab/@dynSeries/align.m index 4b3d459608c9e022af06256010caf2c66979234a..6312df808091cd71835517ab7ce979e8b0fe6407 100644 --- a/matlab/@dynSeries/align.m +++ b/matlab/@dynSeries/align.m @@ -80,16 +80,14 @@ if last_a>last_b n = last_a-last_b; b.data = [b.data; NaN(n,b.vobs)]; b.nobs = b.nobs+n; - return -end - -if last_a<last_b +elseif last_a<last_b n = last_b-last_a; a.data = [a.data; NaN(n,a.vobs)]; a.nobs = a.nobs+n; - return end +a.time = a.init:a.init+(a.nobs-1); + %@test:1 %$ % Define a datasets. %$ A = rand(8,3); B = rand(7,2); diff --git a/matlab/@dynSeries/baxter_king_filter.m b/matlab/@dynSeries/baxter_king_filter.m index 21a8dd930687f8147279f7b4bbbf0734782dd81b..a60f2bc826584b67772d87c612cc5263afe01f43 100644 --- a/matlab/@dynSeries/baxter_king_filter.m +++ b/matlab/@dynSeries/baxter_king_filter.m @@ -95,7 +95,7 @@ end ts.data = tmp(K+1:end-K,:); ts.nobs = ts.nobs-2*K; ts.init = ts.init+K; -ts.time = ts.init:ts.init+ts.nobs; +ts.time = ts.init:ts.init+(ts.nobs-1); %@test:1 %$ plot_flag = 0; diff --git a/matlab/@dynSeries/dynSeries.m b/matlab/@dynSeries/dynSeries.m index 9d56f5b5f72b43bd6d3a9258ace80597861c43a1..87afc04212b3fcb988d68ff0bf12fd654010f7b4 100644 --- a/matlab/@dynSeries/dynSeries.m +++ b/matlab/@dynSeries/dynSeries.m @@ -146,7 +146,6 @@ switch nargin [ts.nobs, ts.vobs] = size(ts.data); ts.freq = 1; ts.init = dynDate(1); - ts.time = ts.init:ts.init+ts.nobs; ts.name = default_name(ts.vobs); ts.tex = name2tex(ts.name); end @@ -212,7 +211,7 @@ switch nargin error('dynSeries::dynSeries: Can''t instantiate the class, wrong calling sequence!') end -ts.time = ts.init:(ts.init+ts.nobs); +ts.time = ts.init:ts.init+(ts.nobs-1); %@test:1 %$ % Test if we can instantiate an empty dynSeries object. diff --git a/matlab/@dynSeries/merge.m b/matlab/@dynSeries/merge.m index 25e3183baf0e6c429bd09b4beab7547dec05a009..4fa16e36331a3f0b35d1395fccd14d786025b720 100644 --- a/matlab/@dynSeries/merge.m +++ b/matlab/@dynSeries/merge.m @@ -83,7 +83,7 @@ else A.init = B.init; end -A.time = A.init:A.init+A.nobs; +A.time = A.init:A.init+(A.nobs-1); %@test:1 %$ % Define a datasets. diff --git a/matlab/@dynSeries/plus.m b/matlab/@dynSeries/plus.m index 8df7178c6340bcea709dee038030539fb7339c92..faa940e2c79b1f301e3dea9b8b0d6a50654e4def 100644 --- a/matlab/@dynSeries/plus.m +++ b/matlab/@dynSeries/plus.m @@ -116,7 +116,7 @@ for i=1:A.vobs A.tex(i) = {['(' B.tex{idB(i)} '+' C.tex{idC(i)} ')']}; end A.data = bsxfun(@plus,B.data,C.data); -A.time = A.init:A.init+A.nobs; +A.time = A.init:A.init+(A.nobs-1); %@test:1 %$ % Define a datasets. diff --git a/matlab/@dynSeries/subsasgn.m b/matlab/@dynSeries/subsasgn.m index 31e849c3c1cde6f5e8f8ad7fcd517d50752ddf8f..fe655bd85e181c95874f7a6418e86d4f2592bbe5 100644 --- a/matlab/@dynSeries/subsasgn.m +++ b/matlab/@dynSeries/subsasgn.m @@ -103,7 +103,7 @@ switch length(S) A.init = B; % ... and update freq and time members. A.freq = A.init.freq; - A.time = A.init:(A.init+(A.nobs-1)); + A.time = A.init:A.init+(A.nobs-1); return elseif isequal(S(1).subs,'time') && isa(B,'dynDates') % Overwrite the time member... diff --git a/matlab/reports/@series/getName.m b/matlab/reports/@series/getName.m index 9340359631dda4c6f8c0f8cd689d0927fc420630..70066c57fe36245061264418358124e6f40a17f1 100644 --- a/matlab/reports/@series/getName.m +++ b/matlab/reports/@series/getName.m @@ -19,5 +19,5 @@ function s = getName(o) % along with Dynare. If not, see <http://www.gnu.org/licenses/>. assert(~isempty(o.data) && size(o.data, 2) == 1); -s = o.data(1).name(); +s = o.data.name; end \ No newline at end of file diff --git a/matlab/reports/@series/getTexName.m b/matlab/reports/@series/getTexName.m index e79660836288717595209ff93b39690da3aeb906..430b29828aae2691004b817755b1a5839466a329 100644 --- a/matlab/reports/@series/getTexName.m +++ b/matlab/reports/@series/getTexName.m @@ -19,5 +19,5 @@ function s = getTexName(o) % along with Dynare. If not, see <http://www.gnu.org/licenses/>. assert(~isempty(o.data) && size(o.data, 2) == 1); -s = o.data(1).tex(); +s = o.data.tex; end \ No newline at end of file diff --git a/tests/.gitignore b/tests/.gitignore index 3fd1bd8385af22d7886719e8f2ad6c6538b18b6b..34a3efcf15e25b38e1ca73a2714efe0bb1b2e0c4 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -11,6 +11,7 @@ *.dat *.prn *_simul +*-macroexp.mod wsOct /run_test_octave_output.txt