Matlab function with several inputs!

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Matlab function with several inputs!

Postby Glm » Mon Mar 07, 2016 3:35 pm

Hi!

in order to solve the steady state for my model I have some non-linear equations. In this case 3 nonlinear equations. This implies that my Matlab function needs 3 input variables and will return 3 output variables once it's done. But the problem is that the steady state block won't except a vector, only integers.

In the example below I have

x2=[1;0.99;1.3];
x=fixa_micro(x2,delta,delta_e,a,beta,alpha,omega,PHI,mc);
n=x(1);
h=x(2);
k=x(3);

Then Dynare complains both about that "x2" is a vector and that x is a vector. So what should I do to solve this problem?


My steady state block in my mod-file looks like this

steady_state_model;
mu=0;
hiring=0;
mc=(beta*theta+eta-1)/eta;
x2=[1;0.99;1.3];
x=fixa_micro(x2,delta,delta_e,a,beta,alpha,omega,PHI,mc);
n=x(1);
h=x(2);
k=x(3);
e=(1-h)/delta_e;
y_firm=(e^a)*((alpha*k^((omega-1)/omega)+(1-alpha)*(h*n)^((omega-1)/omega))^(omega/(omega-1))-PHI);
w=(1-alpha)*(h^((omega-1)/omega))*mc*(((y_firm+(e^a)*PHI)/n)^(1/omega));
p_ss=(beta*alpha/(1-beta*(1-delta)))*mc*((y_firm+(e^a)*PHI)/k)^(1/omega);
p=p_ss;
p_firm=p_ss;
productivity=y_firm/n;
investment=delta*k;
mu_e=(a*beta/(1-beta*(1-delta_e)))*mc*(y_firm/e);
w_ss=w;
D=1;


\\\Glm
Glm
 
Posts: 47
Joined: Tue Jan 17, 2012 12:54 pm

Re: Matlab function with several inputs!

Postby jpfeifer » Mon Mar 07, 2016 5:54 pm

Please provide me with the full file.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Matlab function with several inputs!

Postby Glm » Tue Mar 08, 2016 12:02 pm

Hi!

I've attached the modfile as well as the Matlab files that solves the non-linear steady state variables.

\Glm
Attachments
fixa_micro.m
(1.11 KiB) Downloaded 74 times
Johannes.mod
(6.56 KiB) Downloaded 86 times
Glm
 
Posts: 47
Joined: Tue Jan 17, 2012 12:54 pm

Re: Matlab function with several inputs!

Postby jpfeifer » Thu Mar 10, 2016 11:02 am

Please provide all files. I think the parametrar_funktion.m is missing.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 12 guests