Why do I get this error 'Error using size Dimension argument must be a positive integer scalar within indexing range. Error in var (line 109) n = size(x,dim);'
Show older comments
Hello, I am using Daynare with matlab (student use). I want to test this code, but I get this error. Can anybody help me?
var c k n z;
varexo e;
parameters beta chi delta alpha rho ;
%----------------------------------------------------------------
alpha = 0.33;
beta = 0.99;
delta = 0.023;
chi = 1.75;
rho = 0.95;
%----------------------------------------------------------------
model;
(1/c) = beta*(1/c(+1))*(1+alpha*(k^(alpha-1))*exp(z(+1))*(n(+1))^(1-alpha)-delta);
chi*c/(1-n) = (1-alpha)*(k(-1)^alpha)*exp(z)*(n^(-alpha));
c+ k-(1-delta)*k(-1) = (k(-1)^alpha)*exp(z)*n^(1-alpha);
z = rho*z(-1)+e;
end;
%----------------------------------------------------------------
initval;
k = 9;
c = 0.76;
n = 0.3;
z = 0;
e = 0;
end;
steady;
check;
%---------------------------------------------
%Temp shock
%shocks;
%var e ; periods 1:10;
%values 0.01;
%end;
%Perm shock
endval;
k = 9;
c = 0.76;
n = 0.3;
z = 0;
e = 0.01;
end;
steady;
shocks;
var e ; periods 1:9;
values 0;
end;
%-----------------------------------------
simul(periods=200);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tt=1:202';
subplot(2,2,1);
plot(tt,oo_.endo_simul(1,:),tt,oo_.steady_state(1)*ones(1,202),'LineWidth',2);
title('C')
subplot(2,2,2);
plot(tt,oo_.endo_simul(2,:),tt,oo_.steady_state(2)*ones(1,202),'LineWidth',2);
title('K')
subplot(2,2,3);
plot(tt,oo_.endo_simul(3,:),tt,oo_.steady_state(3)*ones(1,202),'LineWidth',2);
title('N');
subplot(2,2,4);
plot(tt,oo_.endo_simul(4,:),'LineWidth',2);
title('z')
Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!