diff --git a/matlab/perfect-foresight-models/perfect_foresight_solver_core.m b/matlab/perfect-foresight-models/perfect_foresight_solver_core.m
index e842e818ff61115a98337cf31ffb5766153142fd..b336c4d0356fc576888583721bf2c8d05d66e0a1 100644
--- a/matlab/perfect-foresight-models/perfect_foresight_solver_core.m
+++ b/matlab/perfect-foresight-models/perfect_foresight_solver_core.m
@@ -39,6 +39,10 @@ if options_.linear_approximation && ~(isequal(options_.stack_solve_algo,0) || is
     error('perfect_foresight_solver: Option linear_approximation is only available with option stack_solve_algo equal to 0 or 7.')
 end
 
+if options_.endogenous_terminal_period && options_.stack_solve_algo ~= 0
+    error('perfect_foresight_solver: option endogenous_terminal_period is only available with option stack_solve_algo equal to 0')
+end
+
 if options_.linear && (isequal(options_.stack_solve_algo, 0) || isequal(options_.stack_solve_algo, 7))
     options_.linear_approximation = true;
 end