diff --git a/matlab/missing/mex/mjdgges/mjdgges.m b/matlab/missing/mex/mjdgges/mjdgges.m
index 56956180690e102d4dbccd1b4d02019adc893cf5..b28214e9234bcaa17c28ea62b6be94601d9093fd 100644
--- a/matlab/missing/mex/mjdgges/mjdgges.m
+++ b/matlab/missing/mex/mjdgges/mjdgges.m
@@ -56,7 +56,7 @@ end
 info = 0;
 
 try
-    if isoctave
+    if isoctave && octave_ver_less_than('9')
         [ss, tt, qq, zz] = qz(e, d);
     else
         [ss, tt, qq, zz] = qz(e, d, 'real');
diff --git a/matlab/partial_information/PI_gensys.m b/matlab/partial_information/PI_gensys.m
index 3fe2c16ba4b896b7104afc4b43e26fb42479df6a..42ee00f8abb8fb6a821f1c8a66eb4147b3d163a7 100644
--- a/matlab/partial_information/PI_gensys.m
+++ b/matlab/partial_information/PI_gensys.m
@@ -16,7 +16,7 @@ function [G1pi,C,impact,nmat,TT1,TT2,gev,eu, DD, E2, E5, GAMMA, FL_RANK ]=PI_gen
 % Corrected 10/28/96 by CAS
 
 % Copyright © 1996-2009 Christopher Sims
-% Copyright © 2010-2017 Dynare Team
+% Copyright © 2010-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -176,8 +176,8 @@ end
 
 G0pi=eye(n+FL_RANK+NX);
 try
-    if isoctave
-        % Need to force QZ complex on Octave (otherwise it returns the real one)
+    if isoctave && octave_ver_less_than('9')
+        % Need to force QZ complex on Octave ⩽ 8 (otherwise it returns the real one)
         [a b q z]=qz(complex(G0pi),complex(G1pi));
     else
         [a b q z]=qz(G0pi,G1pi);
diff --git a/matlab/sylvester3.m b/matlab/sylvester3.m
index b290b6220c1446639d1ad18b89b419c686ba7272..88e7af73264cf8b7dcc7a73c8c7560f41811e672 100644
--- a/matlab/sylvester3.m
+++ b/matlab/sylvester3.m
@@ -1,7 +1,7 @@
 function x=sylvester3(a,b,c,d)
 % solves a*x+b*x*c=d where d is [n x m x p]
 
-% Copyright © 2005-2017 Dynare Team
+% Copyright © 2005-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -35,13 +35,13 @@ if m == 1
     return
 end
 [u,t]=schur(c);
-if isoctave
+if isoctave && octave_ver_less_than('9')
     [aa,bb,qq,zz]=qz(full(a),full(b));
     for j=1:p
         d(:,:,j)=qq*d(:,:,j)*u;
     end
 else
-    [aa,bb,qq,zz]=qz(full(a),full(b),'real'); % available in Matlab version 6.0
+    [aa,bb,qq,zz]=qz(full(a),full(b),'real');
     for j=1:p
         d(:,:,j)=qq*d(:,:,j)*u;
     end