Some notes on Dynare 4.....
  
1. Introduction
Dynare is a program that you execute from inside MATLAB. It takes instructions that you write in a file with extension .mod that 
you create. It translates that file into a MATLAB file that it then automatically executes. 
    
There are some pieces of information you will have to provide to Dynare in the .mod file...what are the equations (equilibrium conditions)
  of your model? What are the parameter values of the model? What are the exogenous shocks, and what are the standard deviations
  of those shocks? Also, in practice, it is a good idea for you to provide a program (written in MATLAB) which computes the 
  steady state of the model. Dynare can try to compute the steady state, but in practice it can do so without any assistance 
  only if the model is very simple. For models of reasonable size, Dynare will at least require that you give it a very good 
  guess of the steady state. 

2. Details
dynare writes three files based on your mod file
  name_static.m, name_dynamic.m, name.m
  these include the main MATLAB program that executes the commands you placed in the mod file (i.e., name.m, if your mod file is
  name.mod). In addition, there is the list of dynamic equations (name_dynamic.m) and the list of steady state equations,
  (name_static.m). 
    
in your mod file, you must:
declare the endogenous variables in a Dynare var command. This includes what you normaly think of as 'endogenous variables' plus
  the exogenous shocks. The format is: var variable1, variable2,...;
declare the exogenous variables in a Dynare varexo command. These are the innovations to the exogenous shocks. The
  format is: varexo variable1, variable2,...;
declare the list of constants which Dynare will need when it executes the name_static.m and name_dynamic.m files. The format
  is: parameters constant1, constant2, ...; 
  for each constant in the parameter statement, there MUST be an equation in your mod file (or, a script file called from inside 
  MATLAB) that assigns a value to it. That equation
  must look like constanti = some kind of MATLAB expression. This is important and could get you in trouble if not followed exactly.
  For example, suppose the values of some of the constants in the parameters statement are returned as output from a MATLAB m function file
  that you call from inside your mod file. For example, suppose the value of constanti is determined in this way. If function is 
  the m file in which the value of constanti is computed (it might be a steady state value of a variable), then call the function
  like this [x]=function(inputs), where inputs is the list of inputs used by function, and set constanti in a MATLAB command, 
  constanti=x;
  
you have to write down the equations of your model. Before the first equation is the Dynare command, model;, and after the last 
  equation there is a line with the Dynare command, end;

note how all dynare commands must end with a semicolon.

You can think of your mod file as a sort of matlab file that contains a mixture of MATLAB and Dynare commands.


Structures...
In using Dynare 4 it is useful to be aware that in MATLAB, there are vectors and matrices, as well as 'structures'. All the structures that
    you've created (for example, the ones created by Dynare) can be viewed in the MATLAB workspace.

A vector is something like A, a collection of numbers arranged either as a column (column vector) or a row (i.e., row vector) or a matrix.

A structure is a collection of objects. It has the format, name.xx, where name is the name of the structure and xx is the name 
    of the field in the structure. Structures are a nice organizing device. You take objects with some similar characteristics and make them fields
    in one structure.

the values of the parameters in your parameters command are stored in the field 'params', in the structure, 'M_', i.e., in M_.params

the M_ structure has other information too. You can see what all the fields are in a structure by typing name (i.e., the name
    of the structure, say M_) at the MATLAB command prompt.

there are other interesting structures. For example, oo_ contains various numerical results, oo_.steady_state contains the steady state of the
    variables in the model. Since the contents of this field is just a sequence of numbers, you need to know what variables 
    they correspond to. They correspond to the variables in the var command, in the order in which you typed them into the var
    command. You can confirm what these variables are and their order by typing, at the MATLAB prompt, M_.endo_names.
    
The solution to the model may also be found in oo_. Write y_t = y_ss + A*(y_t-1 - ys) + B*u_t, where A and B are the matrices that characterize
       the solution. The matrix, A, can be found in oo_.dr.ghx. The rows correspond to the 'reordered' variables. The columns correspond to 
       state variables - a subset of the elements in y_t-1. You can determine the order of the 'reordered' variables as follows. The order 
       of the variables in the var command can be determined by looking at the contents of M_.endo_names. This just gives the names of 
       the variables in the order in which they appear in the var command. To see what order the variables are in when reordered, type 
       M_.endo_names(oo_.dr.order_var,:). The vector oo_.dr.order_var contains the reordering. It may be easier to understand ghx if 
       you reorder the rows of ghx in the order of the variables in the var command, i.e., look at oo_.dr.ghx(oo_.dr.inv_order_var,:) 
       The matrix B can be found in oo_.dr.ghu The rows of B are also in reordered form, and it may be easier to look at 
       oo_.dr.ghu(oo_.dr.inv_order_var,:).
    
    
Documentation....
    a nice online manual is available at http://www.cepremap.cnrs.fr/juillard/mambo/download/manual/index.html.    