Function Help: recsSolveREE View code for recsSolveREE Function Reference
recsSolveREE
```  recsSolveREE finds the rational expectations equilibrium (REE) of a model

recsSolveREE implementes various approximation schemes, and equation solvers to
find the REE of a model.

INTERP = recsSolveREE(INTERP,MODEL,S,X) tries to find the rational expectations
equilibrium of the model defined in the object MODEL, by using the
interpolation structure defined in the structure INTERP. The problem is solved
on the grid of state variables provided in matrix S. Matrix X is used as a
first guess of response variables on the grid. recsSolveREE returns the
interpolation structure containing the coefficient matrices cx
and cz, and ch if this field was initially included in INTERP.
INTERP is a structure, which has to include the following field:
fspace       : a definition structure for the interpolation family (created
by the function fundef)
Optionally INTERP can also include first guess for the coefficients of
approximation. If absent, an approximation is made from X.
ch, cx or cz : a coefficient matrix providing a first guess of the
approximation of the expectations function for ch, of the
response variables for cx, or of the expectations for cz
MODEL is an object created by recsmodel.

INTERP = recsSolveREE(INTERP,MODEL,S,X,OPTIONS) solves the problem with the
parameters defined by the structure OPTIONS. The fields of the structure are
display          : 1 to show iterations (default: 1)
eqsolver         : 'fsolve', 'lmmcp' (default), 'ncpsolve' or 'path'
eqsolveroptions  : options structure to be passed to eqsolver
extrapolate      : 1 or 2 if extrapolation is allowed outside the
interpolation space, 0 or -1 to forbid it (default: 1).
For -1 and 2, recsSolveREE displays a warning if state
variables exceed the interpolation space.
funapprox        : 'expapprox', 'expfunapprox', or 'resapprox' (default)
functional       : 1 if the equilibrium equations are a functional equation
problem (default: 0)
loop_over_s      : 0 (default) to solve all grid points at once, 1 to loop
over each grid points, or n to loop over n blocks of
grid points
reemethod        : 'iter' (default) or '1-step'
reesolver        : 'krylov', 'mixed', 'SA' (default) or 'fsolve'
reesolveroptions : options structure to be passed to reesolver
useapprox        : (default: 1) behaviour dependent of the chosen function to
approximate. If 0 and funapprox is 'expapprox' then
next-period responses are calculated by equations solve and
not just interpolated. If 1 and funapprox is 'resapprox', the
guess of response variables is found with the new
approximation structure
UseParallel        : 'always' (default) to use parallel calculation (require
Parallel Computing Toolbox)' or never'

[INTERP,X] = recsSolveREE(INTERP,MODEL,S,X,...) returns the value of the response
variables on the grid.

[INTERP,X,Z] = recsSolveREE(INTERP,MODEL,S,X,...) returns the value of the
expectations variables on the grid.

[INTERP,X,Z,FVAL] = recsSolveREE(INTERP,MODEL,S,X,...) returns the value of the
equilibrium equations on the grid.

[INTERP,X,Z,FVAL,EXITFLAG] = recsSolveREE(INTERP,MODEL,S,X,...) returns EXITFLAG,
which describes the exit conditions. Possible values are
1 : recsSolveREE converges to the REE
0 : Failure to converge

[INTERP,X,Z,FVAL,EXITFLAG,OUTPUT] = recsSolveREE(INTERP,MODEL,S,X,...) returns
OUTPUT, a structure containing the fields snextmin and snextmax, minimum and
maximum of next-period state variables.```