interaction with matlab programs

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.

interaction with matlab programs

Postby pburriel » Thu Mar 30, 2006 5:42 pm

Dear all,

I have a possibly very silly question.

I am having trouble with the interaction between dynare and other matlab programs.

I have written a standard dynare program to solve a DSGE model and it works fine.

However, I wanted to start playing around with the calibration and to do this I use a matlab program that solves for part of the steady state of the model. The problem is that when I try to set some of the calibrated parameters equal to the result of that program dynare gives me the following error message:

??? Error using ==> dynare
syntax error at line 717

which is the line in which I call the matlab file that defines the vector of coefficients. I think dynare is trying to tell me that it cannot communicate with that matlab program.

What is the problem with this? Is it not possible to define the calibration of the parameters for the dynare program by calling the results from another matlab program?

Thanks,

Pablo
pburriel
 
Posts: 23
Joined: Wed Jun 29, 2005 4:42 am

Postby MichelJuillard » Thu Mar 30, 2006 6:55 pm

Hello Pablo,

it looks like Dynare thinks that line 717 is Dynare syntax, but wrong Dynare syntax. Most likely it starts like a Dynare command. What is this line?

Best

Michel
MichelJuillard
 
Posts: 680
Joined: Thu Nov 18, 2004 10:51 am

interaction with matlab programs

Postby pburriel » Fri Mar 31, 2006 8:10 am

Michel,

What I do is something like this. In a dynare program, when I get to defining the parameters:

"
// 1.3 Parameters of the model

parameters

beta // discount rate
gamma // habits
;

//----------------------------------------------------------------
// 2. Calibration of parameters
//----------------------------------------------------------------

parm_calibration= zeros(2,1);
calibrationsymmetric;
parm_calibration=parm_calibrationsymm;

beta = parm_calibration(1);
gamma = parm_calibration(2);
"

where the file calibrationsymmetric.m goes as follows:

"
parm_calibrationsymm= zeros(2,1);
parm_calibrationsymm(1)=(1.03)^(-0.25);//beta
parm_calibrationsymm(2)=0.7500;//gamma
"

That is, all I am doing is define a vector that I fill in another file and then call it from the dynare program to set the calibration.

Is this right?

Pablo
pburriel
 
Posts: 23
Joined: Wed Jun 29, 2005 4:42 am

Postby MichelJuillard » Fri Mar 31, 2006 10:01 am

Hi Pablo,

I believe that the problem is with the file name
calibrationsymmetric

because it starts as an undocumented Dynare command 'calib'
try instead
eval('calibrationsymmetric');

If it doesn't work send me the *.mod file and calibrationsymmetric.m

Best

Michel
MichelJuillard
 
Posts: 680
Joined: Thu Nov 18, 2004 10:51 am

interaction with matlab programs

Postby pburriel » Sun Apr 02, 2006 4:08 pm

Michel,

Find attached the file "prueba.mod" with the model. The problem is in line 575. The other file is the matlab file where I define the parameters.

Thanks,

Pablo
Attachments
prueba.mod
(64.5 KiB) Downloaded 140 times
calibrationsymmetric.m
(10.21 KiB) Downloaded 117 times
pburriel
 
Posts: 23
Joined: Wed Jun 29, 2005 4:42 am

Postby MichelJuillard » Mon Apr 03, 2006 11:39 am

I fixed two things

1) the right Matlab function is eval() not evalin()
2) calibrationsymmetric.m is a Matlab file, not a Dynare one. So, you must use Matlab comment sign % and not Dynare //

I'm attaching the corrected files

Best

Michel
Attachments
calibrationsymmetric.m
(10 KiB) Downloaded 152 times
prueba.mod
(64.5 KiB) Downloaded 153 times
MichelJuillard
 
Posts: 680
Joined: Thu Nov 18, 2004 10:51 am


Return to Dynare help

Who is online

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