i cannot solve the Dynare functions in matlab, is there any thing wrong with my code
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Fabio Franceschini
am 27 Sep. 2021
Interesting! Then I guess the problem lies in the derivation of the equations stated at the beginning
Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

