quick_start.md 7.23 KB
Newer Older
Houtan Bastani's avatar
Houtan Bastani committed
1
2
3
4
5
---
title: Quick Start
---
<br />

6
7
{% include dynare_stable_version.md %}

Houtan Bastani's avatar
Houtan Bastani committed
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
For those who want to quickly have something running, this page explains how to
setup Dynare on [Windows](#windows) or [macOS](#macos) and to run your first
model (`.mod`) file.

To run Dynare, you have the choice between running it on MathWorks MATLAB
(proprietary) or GNU Octave (free software).

# Windows

## Using Dynare with MATLAB

 1. Make sure that MATLAB is installed on your computer.
 1. Download and install the [latest Dynare package](/download#stable)
 1. Open MATLAB
 1. Configure MATLAB for Dynare (see [the section below](#configuring-matlab-for-dynare-on-windows))
 1. Run a Dynare example in MATLAB (see [the section below](#running-and-editing-a-dynare-example-on-windows))

## Using Dynare with Octave

27
 1. Download and install the <i class="fas fa-external-link-alt"></i> [Octave installer](https://www.gnu.org/software/octave/download.html)
Houtan Bastani's avatar
Houtan Bastani committed
28
29
30
31
32
33
34
35
36
37
38
39
40
 1. Download and install the [latest Dynare package](/download#stable)
 1. Open Octave
 1. Configure Octave for Dynare (see [the section below](#configuring-octave-for-dynare-on-windows))
 1. Run a Dynare example in Octave (see [the section below](#running-and-editing-a-dynare-example-on-windows))

## Configuring MATLAB for Dynare on Windows

You have two choices. You can either use the [command window](#1-configuring-matlab-using-the-command-window-on-windows) or the [menu entries](#2-configuring-matlab-using-the-menu-entries-on-windows).

### 1. Configuring MATLAB using the Command Window on Windows

You will have to do this every time you start MATLAB, as MATLAB will not remember the setting.

Sébastien Villemot's avatar
Sébastien Villemot committed
41
 1. Click on the “Command Window”
Houtan Bastani's avatar
Houtan Bastani committed
42
43
44
45
 1. If you have Dynare installed in the standard location, type the following, replacing `4.x.y` with your Dynare version:
    ```
    >> addpath C:\dynare\4.x.y\matlab
    ```
46
    For example, for Dynare {{ dynare_stable_version }} type:
Houtan Bastani's avatar
Houtan Bastani committed
47
    ```
48
    >> addpath C:\dynare\{{ dynare_stable_version }}\matlab
Houtan Bastani's avatar
Houtan Bastani committed
49
50
51
52
53
54
55
56
    ```

### 2. Configuring MATLAB using the menu entries on Windows

You will only have to do this once as MATLAB will remember the setting the next time you run it.

 1. On the MATLAB `Home` tab, in the `Environment` section, click on `Set Path`
 1. Click `Add Folder...`. <i class="fas fa-exclamation-triangle"></i> **Warning: DO NOT** select `Add with Subfolders...`
57
 1. Select the `matlab` subdirectory of your Dynare installation. For example, if you have installed Dynare {{ dynare_stable_version }} in the standard location, select:
Houtan Bastani's avatar
Houtan Bastani committed
58
    ```
59
    C:\dynare\{{ dynare_stable_version }}\matlab
Houtan Bastani's avatar
Houtan Bastani committed
60
61
62
63
64
65
66
67
68
69
    ```
 1. Apply the setting by clicking `Save` button

## Configuring Octave for Dynare on Windows

If you have Dynare installed in the standard location type the following at the Octave command prompt, replacing `4.x.y` with your Dynare version:
Windows
```
>> addpath C:\dynare\4.x.y\matlab
```
70
For example, for Dynare {{ dynare_stable_version }} type:
Houtan Bastani's avatar
Houtan Bastani committed
71
```
72
>> addpath C:\dynare\{{ dynare_stable_version }}\matlab
Houtan Bastani's avatar
Houtan Bastani committed
73
```
Sébastien Villemot's avatar
Sébastien Villemot committed
74
If you don’t want to type this command every time you run Octave, you can put it in a file called `.octaverc` in your home directory. This file will usually be called `C:\Users\USERNAME\.octaverc`.
Houtan Bastani's avatar
Houtan Bastani committed
75
76
77
78

## Running and editing a Dynare example on Windows

 1. Create a working directory that will hold your Dynare models. For example, `C:\dynare\work`.
79
 1. Assuming that you are using Dynare {{ dynare_stable_version }}, copy the example model file `C:\dynare\{{ dynare_stable_version }}\examples\example1.mod` to your working directory.
Houtan Bastani's avatar
Houtan Bastani committed
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
 1. At the MATLAB or Octave command prompt, type the following to change the working directory:
    ```
    >> cd C:\dynare\work
    ```
 1. Then type the following to run the example model file:
    ```
    >> dynare example1
    ```
 1. You can edit the example by typing:
    ```
    >> edit example1.mod
    ```

<br />

# macOS

## Using Dynare with MATLAB

 1. Make sure that MATLAB is installed on your computer.
 1. Download and install the [latest Dynare package](/download#stable)
 1. Open MATLAB
 1. Configure MATLAB for Dynare (see [the section below](#configuring-matlab-for-dynare-on-macos))
 1. Run a Dynare example in MATLAB (see [the section below](#running-and-editing-a-dynare-example-on-macos))

## Using Dynare with Octave

107
108
109
110
111
112
113
114
115
116
 1. Install [Homebrew](https://brew.sh/)
 1. Install Dynare (and Octave) by typing the following in a terminal:
    ```
    brew install dynare
    ```
 1. Open Octave by running the following in a terminal:
    ```
    octave --gui
    ```
 1. Install some Octave add-ons from the Octave prompt (you only have to do it once)
117
118
119
    ```
    >> pkg install -forge io statistics control struct optim
    ```
Houtan Bastani's avatar
Houtan Bastani committed
120
121
122
123
124
125
126
127
128
129
130
 1. Configure Octave for Dynare (see [the section below](#configuring-octave-for-dynare-on-macos))
 1. Run a Dynare example in Octave (see [the section below](#running-and-editing-a-dynare-example-on-macos))

## Configuring MATLAB for Dynare on macOS

You have two choices. You can either use the [command window](#1-configuring-matlab-using-the-command-window-on-macos) or the [menu entries](#2-configuring-matlab-using-the-menu-entries-on-macos).

### 1. Configuring MATLAB using the Command Window on macOS

You will have to do this every time you start MATLAB, as MATLAB will not remember the setting.

Sébastien Villemot's avatar
Sébastien Villemot committed
131
 1. Click on the “Command Window”
Houtan Bastani's avatar
Houtan Bastani committed
132
133
134
135
 1. If you have Dynare installed in the standard location, type the following, replacing `4.x.y` with your Dynare version:
    ```
    >> addpath /Applications/Dynare/4.x.y/matlab
    ```
136
    For example, for Dynare {{ dynare_stable_version }} type:
Houtan Bastani's avatar
Houtan Bastani committed
137
    ```
138
    >> addpath /Applications/Dynare/{{ dynare_stable_version }}/matlab
Houtan Bastani's avatar
Houtan Bastani committed
139
140
141
142
143
144
145
146
    ```

### 2. Configuring MATLAB using the menu entries on macOS

You will only have to do this once as MATLAB will remember the setting the next time you run it.

 1. On the MATLAB `Home` tab, in the `Environment` section, click on `Set Path`
 1. Click `Add Folder...`. <i class="fas fa-exclamation-triangle"></i> **Warning: DO NOT** select `Add with Subfolders...`
147
 1. Select the `matlab` subdirectory of your Dynare installation. For example, if you have installed Dynare {{ dynare_stable_version }} in the standard location, select:
Houtan Bastani's avatar
Houtan Bastani committed
148
    ```
149
    /Applications/Dynare/{{ dynare_stable_version }}/matlab
Houtan Bastani's avatar
Houtan Bastani committed
150
151
152
153
154
    ```
 1. Apply the setting by clicking `Save` button

## Configuring Octave for Dynare on macOS

155
Type the following at the Octave command prompt:
Houtan Bastani's avatar
Houtan Bastani committed
156
```
157
>> addpath /usr/local/lib/dynare/matlab
Houtan Bastani's avatar
Houtan Bastani committed
158
159
```

Sébastien Villemot's avatar
Sébastien Villemot committed
160
If you don’t want to type this command every time you run Octave, you can put
Houtan Bastani's avatar
Houtan Bastani committed
161
it in a file called `.octaverc` in your home directory. This file will usually
162
be called `/Users/USERNAME/.octaverc`.
Houtan Bastani's avatar
Houtan Bastani committed
163
164
165

## Running and editing a Dynare example on macOS

166
167
168
169
 1. Create a working directory that will hold your Dynare models. For example, `/Users/USERNAME/work`.
 1. Assuming that you are using Dynare {{ dynare_stable_version }}, copy the
    example model file (either `/Applications/Dynare/{{ dynare_stable_version }}/examples/example1.mod` or `/usr/local/lib/dynare/examples/example1.mod`)
    to your working directory.
Houtan Bastani's avatar
Houtan Bastani committed
170
171
 1. At the MATLAB or Octave command prompt, type the following to change the working directory:
    ```
172
    >> cd /Users/USERNAME/work
Houtan Bastani's avatar
Houtan Bastani committed
173
174
175
176
177
178
179
180
181
    ```
 1. Then type the following to run the example model file:
    ```
    >> dynare example1
    ```
 1. You can edit the example by typing:
    ```
    >> edit example1.mod
    ```