i cannot solve the Dynare functions in matlab, is there any thing wrong with my code

1 次查看(过去 30 天)
i want to solve the three variables as below:
i use two different codes:
syms X Y Z
[solX,solY,solZ]=solve('.9945*X^(-1/1.8)*( 0.35*(1-.5)*(.5*1.65)^(.5/(1-.5))*Y^(0.35-1) + 1 - .02 )=1','X - .343*Z^0.83=(1- .9625)','Z = .9945*X^(-1/1.8)*( ( (1/1.65-1)*(.5*1.65)^(1/(1-.5))*Y^0.35 )/( 1-(1-.9625)*.9945*X^(-1/1.8) ) )*(X-(1-.9625))','X','Y','Z')
and
function F = NKS(Z,alpha,xi,nu,delta,phi,chi,bbeta,psi,eta)
% Z(1) = Ngbar
% Z(2) = Kbar
% Z(3) = Sbar
F(1) = bbeta*Z(1)^(-1/psi)*( alpha*(1-xi)*(xi*nu)^(xi/(1-xi))*Z(2)^(alpha-1) + 1 - delta ) - 1;
F(2) = Z(1) - chi*Z(3)^eta -(1- phi);
F(3) = Z(3) - bbeta*Z(1)^(-1/psi)*( ( (1/nu-1)*(xi*nu)^(1/(1-xi))*Z(2)^alpha )/( 1-(1-phi)*bbeta*Z(1)^(-1/psi) ) )*(Z(1)-(1-phi));
end
Z0 = [1.05 ,1.7,0.09];
Z = fsolve(@(Z) NKS(Z,alpha,xi,nu,delta,phi,chi,bbeta,psi,eta),Z0);
Ngbar = Z(1);
Kbar = Z(2);
Sbar = Z(3);
and
bbeta = .9945;
psi = 0.8;
xi = 0.5;
nu = 1.65;
alpha = 1 -((xi/nu)-xi)/(1-xi);
chi = .343;
phi = .98;
eta = .83;
delta = .02;
i know the initial value for Z0 is important, because i could get it solved, however, the value are complex.
In dynare, i cannot use complex value, so is any advice for this?
  4 个评论

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by