- You initialize the shock matrix. It will always be
shock_matrix = zeros(options_.irf,M_.exo_nbr); %create shock matrix with number of time periods in columns
- Then you set the shocks that you want. The row index sets the time period, the column index the shock:
// set shocks for pure news
shock_matrix(1,strmatch('eps_z_news',M_.exo_names,'exact')) = 1; %set news shock to 1 (use any shock size you want)
sets a shock of size 1 for the first period (therefore in the first row) for the exogenous variable eps_z_news
. The command
strmatch('eps_z_news',M_.exo_names,'exact')
is used to find the column in which eps_z_news
is stored. So for a different shock, you need to change the name string.