### What Do We Do Here?

We create two files in Matlab and run a very simple model simulation. The first file is an IRIS model file describing a simple RBC model. The other file is a Matlab m-file program, which reads in the model, and runs and plots a basic simulation. Note that in IRIS, model files only describe the model itself, and not the tasks you wish to perform. The tasks are then specified in your own m-files where you can combine standard Matlab functions with IRIS functions and objects.

You need to have the [download IRIS Toolbox installed] before you start this introduction. Your copy Matlab also needs to include the Optimization Toolbox.

### The Model File

In the Matlab editor, open a new file, and type in the model file as below. Make sure to use *curly braces* for time subscripts in the model file.

Save the file under the name `my_simple_rbc.model`

in your working directory. You can give your model files any name and any extension; it’s though common practice in IRIS to use a `.model`

extension.

### The Matlab Program

In the Matlab editor, create a new m-file with the following contents:

Save the m-file under the name `run_my_model.m`

.

### Run It…

In the command window, type

```
>> run_my_model
```

Make sure that your current working directory in Matlab is the one where you saved both of the above files.

### What Do You See?

You should see a new figure window with the responses of all model variables, `Y`

, `C`

, `K`

, `A`

, and `r`

, to a 10% shock in `ea`

.

Also, there is a few things printed in the commmand window.

### How Does It Work?

The first file, the model file, describes the model variables and model equations. It is a plain text file; the words starting with exclamation marks are IRIS keywords. Again, remember a model file only describes the model, but not the tasks you wish to perform.

The second file is an m-file, or a Matlab script. It combines standard Matlab functions and IRIS functions to perform tasks you wish to perform. This is the way how you tell what to do with your model.

In this m-file, the model file is first read in, and translated into a model object (model objects are complex structures carrying all the pieces of information needed about the model). Then, we use other IRIS functions, such as `sstate( )`

, `solve( )`

, or `simulate( )`

to do various things with such a model object. Note that in the functions that manipulate the model or perform a particular model task, the model object is almost always the first input argument. You can work with as many model objects as you wish at the same time: they can be different instances of the same model file (with different parameters, for instance), or model objects based on different model files.

Of course, you can write more than one m-file to accomplish whatever you need to. In fact, IRIS has been designed to support large model-based systems: from data management, to modeling and forecasting, to reporting. Typical applications of, for instance, forecasting and policy analysis systems at central banks consist of dozens or hundreds of m-files combining IRIS and standard Matlab functions.

### Get the Files

You can download all files if you’re too lazy to type them up.