diff --git a/matlab/ep/extended_path.m b/matlab/ep/extended_path.m index 72f94db0f..a0559d542 100644 --- a/matlab/ep/extended_path.m +++ b/matlab/ep/extended_path.m @@ -79,7 +79,7 @@ make_ex_; make_y_; % Initialize the output array. -time_series = NaN(M_.endo_nbr,sample_size+1); +time_series = zeros(M_.endo_nbr,sample_size); % Set the covariance matrix of the structural innovations. variances = diag(M_.Sigma_e); @@ -106,18 +106,28 @@ if options_.ep.stochastic [r,w] = gauss_hermite_weights_and_nodes(options_.ep.number_of_nodes); switch options_.ep.stochastic case 1 - rr = cell(1); - ww = cell(1); - for i=1:size(M_.Sigma_e,1) - rr = {r}; - ww = {w}; + if M_.exo_nbr>1 + rr = cell(1); + ww = cell(1); + for i=1:size(M_.Sigma_e,1) + rr = {r}; + ww = {w}; + end + rrr = cartesian_product_of_sets(rr{:}); + www = cartesian_product_of_sets(ww{:}); + else + rrr = r; + www = w; end - rrr = cartesian_product_of_sets(rr{:}); - www = cartesian_product_of_sets(ww{:}); www = prod(www,2); + nnn = length(www); otherwise error(['Order ' int2str(options_.ep.stochastic) ' Stochastic Extended Path method is not implemented!']) end +else + rrr = zeros(1,number_of_structural_innovations); + www = 1; + nnn = 1; end % Initializes some variables. @@ -158,140 +168,137 @@ while (t1e-12 + disp('Stochastic Extended Path:: Something is wrong here (potential bug in extended_path.m)!!!') +end \ No newline at end of file diff --git a/tests/ep/ar_steadystate.m b/tests/ep/ar_steadystate.m new file mode 100644 index 000000000..966331f8e --- /dev/null +++ b/tests/ep/ar_steadystate.m @@ -0,0 +1,9 @@ +function [ys, info] = ar_steadystate(ys, exogenous) +% Steady state routine for ar.mod (First order autoregressive process) + +global M_ + +info = 0; + +ys(1)=M_.params(2); +ys(2)=0; \ No newline at end of file