Is it possible to use the matlab function ‘quad’ (which evaluates integral) with Dynare 4?
ps : please, find in the attached file the .mod program, it runs with dynare 3 and not dynare 4, the error message is:
UnknownFunctionNode::eval: operation impossible!
error: the variable or parameter (Hauc) has not been initialized (in derivatives evaluation)
(…)
ERROR: WelfACT.mod:141.22-25: syntax error, unexpected NAME, expecting INT_NUMBER or MINUS or PLUS

At this time it is impossible to use this function in the model block (although it should be possible to use it outside the model block).

Only a restricted set of functions is allowed at this time in the model block (see the reference manual), because Dynare 4 needs to know the analytical derivative of the function (contrary to Dynare 3 which does numerical derivation).

We are going to add in a future version of Dynare the possibility of declaring an arbitrary function and its analytical derivative.

So for the moment you must stick to Dynare 3 for your specific problem.

Thanks Sébastien for this quick reply.
One last question: With this program, firstly, I compute analytically the initial steady state of the model and secondly, I assume that one structural parameter is modified (let assume that it is hitten by a deterministic shock). So, I ask to Dynare to compute the final steady state with a new value of the parameter.
By using dynare v3 and:

‘steady(solve_algo=3)’, the new ss is exactly the same that the initial one (which is weird, since the change in the parameter should have changed the ss values),

‘steady(solve_algo=0)’, the new ss is different.
Do you know how this diffence of results can be explained? Can I trust the results provided by the algorithm used in fsolve?

I don’t think that solve_algo=3 exists in Dynare v3. It was probably introduced in version 4. So in version 3, with solve_algo=3, the steady command does nothing.

Since this post dates back to 2009, I was wondering wether some progress have been made with this respect.

I am currently using Dynare 4.2.0/4.4.0 and when I write:

x = quad(@iota,v,5); with iota being a function defined in an .m file, I get: “character unrecognized by lexer”. I have also used:

function_handle = @iota;
x = quad(function_handle,v,5); and declared function_handle into the list of variables by I get the same error.

I have read the one could go back to version 3 where the first option should work. But I am on a OSX and looks like there is no version 3 for this operation system.

Write a wrapper function that only takes v as an input argument and use this as the external function for Dynare. Within this wrapper function, include the call to

That way, you hide the problematic function handle to Dynare.
2. You need to specify the derivative of this function to Dynare.

Thank you very much for your help. I tried with those codes, but I get “Unknown symbol: name”. I also checked the DynareWiki about the external function dynare.org/DynareWiki/ExternalFunctions, but I get the same message.

I attach the .mod file (please note it’s still in progress) and the functions I’m using for some integrals. g2.m (138 Bytes) g.m (80 Bytes) lambda2.m (200 Bytes) lambda.m (195 Bytes) model2.mod (2.04 KB)

You have to clean up your code. All external function definitions belong before the model block. Moreover, if lambda is an external function, you must not define it as a variable. Finally, you cannot use external functions like variable names, i.e. you cannot call lambda but only lambda(nu).