Incorporating matlab function into dynare

Hi

I’m trying to use matlab to solve for the steady state and then use those steady state values as initial value in the dynare file.

My model_steadystate.m is as exactly as follows:

syms x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13
h=solve(EQ1,EQ2…EQ13)
c1=h.x1(1)
c2=h.x2(1)

G=h.x13(1)

The corresponding part in my model.mod file is as follows:
model;

end;
model_steadstate.m; //the parameter values are passed from .mod to .m file from here I believe
initval;
c1=h.x1(1)
c2=h.x2(1)

G=h.x13(1)
end;

steady;
check;

However, I get “ERROR: model.mod: line 69, col 5: character unrecognized by lexer” (line 69 is the line c1=h.x1(1) in the dynare file) when I run the dynare file. How should I correct this? Is it because I’m not calling the .m file from the .mod file correctly?

Thanks

To cut the long story short: if you have a file to compute the steady state values, do not use initval, but write a full-fledged steady state file. An example is in Dynare 4.4.2 for the NK_baseline.mod. You just need to copy your steady state computation file in between the header and footer of that file and rename the file according to the naming conventions.

I got it to run. But everytime the steady state file crash, the whole process is terminated. Im testing the model with 4 loops for 4 parameters. Is it possible to make it such that if 1 set of parameter values causes crash, the program moves on with the next set rather than terminating? (Im using to solve() function of matlab for my steady state file)

Thanks

Set noprint in stoch_simul to 1 to prevent Dynare crashing on errors. stoch_simul will then return an error code in info that can be used in an if-clause: [Loop over parameters)