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 件のコメント
Fabio Franceschini
2021 年 9 月 27 日
Interesting! Then I guess the problem lies in the derivation of the equations stated at the beginning
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

