user defined first derivatives

Topics: Models
Sep 26, 2014 at 10:10 AM
Hi,

within my nonlinear model, a variable "x" is defined in terms of a discontinuous piecewise function of another variables "y", "z", "d" like
x_t = 0 iff y_t < z_t; x_t = d_t otherwise.
Thus, in the .model file I define x = MyX(y,z,d); and MyX(y,z,d) is my matlab function.
Variables "z" and "d" are purely exogenous stochastic processes, modeled outside IRIS.

Although IRIS can find the model steady state and solve the model, but in the simulation variable "x" always coincides with "d" though sometimes y < z.

My question: Is it possible that IRIS cannot handle piecewise function defined in matlab? How can I supply RIS the first derivatives of this piecewise fnc (what do I need to change in the MyX function signature)?

Thanks for any help.
Coordinator
Sep 26, 2014 at 11:25 AM
Hi

First off, you need to specify that you want to perform a nonlinear simulation. By default, if not told otherwise, IRIS always simulates models using their first-order approximate solution around the steady state. To run a nonlinear simulation, you have to do to things:
  1. In the model file, mark the equation (or equations) that you want to preserve as nonlinear with a #= sign (instead of a plain equal sign). All other equations will be simulated in their first-order approximate form.
  2. When calling the simulate( ) command, use the option 'nonlinear=' and set the option to the number of periods over which you want to preserve nonlinearities.
I would also recumbent that you read the nonlinear simulations tutorial.

Best,
Jaromir
Marked as answer by jaromirbenes on 9/26/2014 at 4:25 AM
Sep 26, 2014 at 9:08 PM
Hello,

thank you for your advice, now it works.

Bambi