Im wondering how could I retrieve the structural (original) matrices in dynare, that is, the matrices that correspond to the original problem dynare has to solve:
However it is possible to reconstruct these matrices using the “*_dynamic.m” file created by Dynare (if your MOD file is “filename.mod”, then Dynare will create a file called “filename_dynamic.mod”).
This file computes the residual of the model, its jacobian (g1) and possibly its hessian (g2), given the dynamic endogenous (y), the exogenous (x) and the parameters. Note that the indices of the dynamic endogenous can be mapped to the original endogenous and leads/lags using the M_.lead_lag_incidence matrix.
The matrices that you need can be reconstructed from the jacobian g1 of the problem, using some transformations related to the M_.lead_lag_incidence matrix.
Here is the code, if someone needs it (I attached prueba.m, needed to make itwork):
//NOTE: Be sure to write the variables in the preamble as following:
//first variables that are both forward and predetermined (state variables),
//then forward variables (control variables),
//and last variables that are just predetermined (exogenous variables).
// Calculates structural matrices: GG FF MM HH (LL JJ KK are all zero to keep it simple)