diff --git a/matlab/PosteriorIRF_core1.m b/matlab/PosteriorIRF_core1.m
index 403c0b557aa2e98472d58cb25c77a79f9d0b5814..ffdbad005925ce99ae821fa3a0961c6756a4b8ce 100644
--- a/matlab/PosteriorIRF_core1.m
+++ b/matlab/PosteriorIRF_core1.m
@@ -145,7 +145,11 @@ while fpar<B
     end
     stock_param(irun2,:) = deep;
     set_parameters(deep);
-    [dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
+    if options_.discretionary_policy
+        [dr,info,M_,options_,oo_] = discretionary_policy_1(options_.instruments,M_,options_,oo_);
+    else
+        [dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
+    end
     oo_.dr = dr;
     if info(1)
         nosaddle = nosaddle + 1;
diff --git a/matlab/discretionary_policy_1.m b/matlab/discretionary_policy_1.m
index 16143e44ec7d3482b03814b2fdad7bd2cecc5635..1ba64e39fefb87c97b86eb871a1db7b581dcae5c 100644
--- a/matlab/discretionary_policy_1.m
+++ b/matlab/discretionary_policy_1.m
@@ -1,6 +1,17 @@
 function [dr, info, M_, options_, oo_]=discretionary_policy_1(Instruments, M_, options_, oo_)
 % Higher-level function for solving discretionary optimal policy
-% Has the same interface as resol.m
+% INPUTS
+% - Instruments   [cell]          array containing instrument names
+% - M_            [structure]     Matlab's structure describing the model (M_).
+% - options_      [structure]     Matlab's structure describing the current options (options_).
+% - oo_           [structure]     Matlab's structure containing the results (oo_).
+%
+% OUTPUTS
+% - dr            [structure]     Reduced form model.
+% - info          [integer]       scalar or vector, error code.
+% - M_            [structure]     Matlab's structure describing the model (M_).
+% - options_      [structure]     Matlab's structure describing the current options (options_).
+% - oo_           [structure]     Matlab's structure containing the results (oo_).
 
 % Copyright (C) 2007-2020 Dynare Team
 %
diff --git a/matlab/selec_posterior_draws.m b/matlab/selec_posterior_draws.m
index 95407609e82c059c886ac41b3544f6e18979ba61..57134bdee8418a603ed9a018392db0ed89c4944b 100644
--- a/matlab/selec_posterior_draws.m
+++ b/matlab/selec_posterior_draws.m
@@ -115,7 +115,11 @@ if info
             pdraws(i,1) = {x2(SampleAddress(i,4),:)};
             if info-1
                 set_parameters(pdraws{i,1});
-                [dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
+                if options_.discretionary_policy
+                    [dr,info,M_,options_,oo_] = discretionary_policy_1(options_.instruments,M_,options_,oo_);
+                else
+                    [dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
+                end
                 pdraws(i,2) = { dr };
             end
             old_mhfile = mhfile;
diff --git a/tests/discretionary_policy/dennis_1_estim.mod b/tests/discretionary_policy/dennis_1_estim.mod
index fa234567bab107ce2e44cd5341d40ba67f820b59..f869a69e661681d0f2e4b473a72ccfd8bed145e0 100644
--- a/tests/discretionary_policy/dennis_1_estim.mod
+++ b/tests/discretionary_policy/dennis_1_estim.mod
@@ -35,7 +35,8 @@ estimated_params;
   kappa, normal_pdf, 0.2, 0.1;
 end;
 
-estimation(order = 1, datafile = dennis_simul, mh_replic = 2000);
+options_.plot_priors=0;
+estimation(order = 1, datafile = dennis_simul, mh_replic = 2000, mh_nblocks=1,smoother,bayesian_irf,moments_varendo) y i pi pi_c q;
 
 if max(abs(oo_.posterior.optimization.mode - [1; 0.3433])) > 0.025
   error('Posterior mode too far from true parameter values');