diff --git a/license.txt b/license.txt
index 9a514fc233323d426801edeec494a557b3335754..43f6280eb41fef21376223c3e61b027bea4e75c8 100644
--- a/license.txt
+++ b/license.txt
@@ -210,7 +210,7 @@ License: GPL-3+
 Files: matlab/lmmcp/catstruct.m
 Copyright: 2005 Jos van der Geest <jos@jasen.nl>
            2013 Christophe Gouel
-           2016-2017 Dynare Team
+           2016-2021 Dynare Team
 License: BSD-2-clause
 
 Files: matlab/lmmcp/lmmcp.m
diff --git a/matlab/+pac/+estimate/iterative_ols.m b/matlab/+pac/+estimate/iterative_ols.m
index aba2345fe758226c2f1d58a4dc672b74d567a421..1de639bb3ae0ab5cd76fd87aeee48d4f0998dc79 100644
--- a/matlab/+pac/+estimate/iterative_ols.m
+++ b/matlab/+pac/+estimate/iterative_ols.m
@@ -303,10 +303,6 @@ end
 
 % Get indices in params0 for other parameters (optimizing agents share plus parameters related to exogenous variables).
 [~, params_id_2] = setdiff(1:length(ipnames_), params_id_1);
-if isoctave && octave_ver_less_than('6')
-    % Under Octave < 6, setdiff() behaves as with the 'legacy' option (i.e. pre-R2012b behaviour)
-    params_id_2 = params_id_2';
-end
 
 % Get indices in params0 for the parameters associated to the exogenous variables.
 params_id_3 = setdiff(params_id_2, params_id_0);
diff --git a/matlab/aggregate.m b/matlab/aggregate.m
index e0d20b4cc8779b9ee6d88fe294ddbb007b44b890..f8b32915a42ca6d9fd064790ff3f072d1445ff71 100644
--- a/matlab/aggregate.m
+++ b/matlab/aggregate.m
@@ -111,11 +111,7 @@ for i=1:length(varargin)
     end
 end
 eqlist = eqlist(1:eqnum,:);
-if isoctave && octave_ver_less_than('6')
-    [~, idx] = unique_stable(eqlist(:,1));
-else
-    [~, idx] = unique(eqlist(:,1), 'stable');
-end
+[~, idx] = unique(eqlist(:,1), 'stable');
 eqlist = eqlist(idx, :);
 
 % Get endogenous variables.
@@ -138,11 +134,7 @@ for i=1:length(varargin)
     fclose(fid);
 end
 elist = elist(1:enum,:);
-if isoctave && octave_ver_less_than('6')
-    [~, idx] = unique_stable(elist(:,1));
-else
-    [~, idx] = unique(elist(:,1), 'stable');
-end
+[~, idx] = unique(elist(:,1), 'stable');
 elist = elist(idx,:);
 
 % Get exogenous variables.
@@ -170,11 +162,7 @@ for i=1:length(varargin)
     fclose(fid);
 end
 xlist = xlist(1:xnum,:);
-if isoctave && octave_ver_less_than('6')
-    [~, idx] = unique_stable(xlist(:,1));
-else
-    [~, idx] = unique(xlist(:,1), 'stable');
-end
+[~, idx] = unique(xlist(:,1), 'stable');
 xlist = xlist(idx,:);
 
 % Get parameter values.
diff --git a/matlab/compute_moments_varendo.m b/matlab/compute_moments_varendo.m
index 936806cc89f34a966bdeab7209bc9a985640e000..80ec3d79d14c3a8f4dbb92967b8b0c43e55170b0 100644
--- a/matlab/compute_moments_varendo.m
+++ b/matlab/compute_moments_varendo.m
@@ -17,7 +17,7 @@ function oo_ = compute_moments_varendo(type, options_, M_, oo_, var_list_)
 % SPECIAL REQUIREMENTS
 %   none
 
-% Copyright (C) 2008-2020 Dynare Team
+% Copyright (C) 2008-2021 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -168,11 +168,7 @@ if options_.order==1
         end
         skipline();
         if ~all(diag(M_.H)==0)
-            if isoctave && octave_ver_less_than('6')
-                [observable_name_requested_vars, varlist_pos] = intersect_stable(var_list_, options_.varobs);
-            else
-                [observable_name_requested_vars, varlist_pos] = intersect(var_list_, options_.varobs, 'stable');
-            end
+            [observable_name_requested_vars, varlist_pos] = intersect(var_list_, options_.varobs, 'stable');
             if ~isempty(observable_name_requested_vars)
                 NumberOfObservedEndogenousVariables = length(observable_name_requested_vars);
                 temp = NaN(NumberOfObservedEndogenousVariables, NumberOfExogenousVariables+1);
diff --git a/matlab/conditional_variance_decomposition.m b/matlab/conditional_variance_decomposition.m
index 8a8b90834f99463802941430ee9b5495363a949d..83020a736d0f31800534c2d90455f350cbf3c42e 100644
--- a/matlab/conditional_variance_decomposition.m
+++ b/matlab/conditional_variance_decomposition.m
@@ -17,7 +17,7 @@ function [ConditionalVarianceDecomposition, ConditionalVarianceDecomposition_ME]
 %                                                    h is the number of Steps
 %                                                    p is the number of state innovations and
 
-% Copyright (C) 2010-2020 Dynare Team
+% Copyright (C) 2010-2021 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -89,11 +89,7 @@ end
 % Measurement error
 
 if ~all(diag(StateSpaceModel.measurement_error)==0)
-    if isoctave && octave_ver_less_than('6')
-        [observable_pos,index_subset,index_observables]=intersect_stable(SubsetOfVariables,StateSpaceModel.observable_pos);
-    else
-        [observable_pos,index_subset,index_observables]=intersect(SubsetOfVariables,StateSpaceModel.observable_pos,'stable');
-    end
+    [observable_pos,index_subset,index_observables]=intersect(SubsetOfVariables,StateSpaceModel.observable_pos,'stable');
     ME_Variance=diag(StateSpaceModel.measurement_error);
 
     ConditionalVarianceDecomposition_ME = zeros(length(observable_pos),length(Steps),number_of_state_innovations+1);
diff --git a/matlab/conditional_variance_decomposition_ME_mc_analysis.m b/matlab/conditional_variance_decomposition_ME_mc_analysis.m
index b9f187298d6d1911944861e7d770d8c6e9731e28..f0e835011b5fdf6ff75a2848a8a1668eaa7224e4 100644
--- a/matlab/conditional_variance_decomposition_ME_mc_analysis.m
+++ b/matlab/conditional_variance_decomposition_ME_mc_analysis.m
@@ -63,11 +63,7 @@ if isempty(exogenous_variable_index)
     end
 end
 
-if isoctave && octave_ver_less_than('6')
-    [observable_pos_requested_vars,index_subset,index_observables]=intersect_stable(var_list,options_.varobs);
-else
-    [observable_pos_requested_vars,index_subset,index_observables]=intersect(var_list,options_.varobs,'stable');
-end
+[observable_pos_requested_vars,index_subset,index_observables]=intersect(var_list,options_.varobs,'stable');
 matrix_pos=strmatch(endo, var_list(index_subset),'exact');
 name_1 = endo;
 name_2 = exo;
diff --git a/matlab/disp_moments.m b/matlab/disp_moments.m
index 94a6709cab66d1d6ff590ec1e6aabb789970a115..f3a86a57b4268ea0884da5ad89969ed8da62cf13 100644
--- a/matlab/disp_moments.m
+++ b/matlab/disp_moments.m
@@ -11,7 +11,7 @@ function oo_=disp_moments(y,var_list,M_,options_,oo_)
 % OUTPUTS
 %   oo_                 [structure]    Dynare's results structure,
 
-% Copyright (C) 2001-2020 Dynare Team
+% Copyright (C) 2001-2021 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -50,11 +50,7 @@ y = y(ivar,options_.drop+1:end)';
 
 ME_present=0;
 if ~all(M_.H==0)
-    if isoctave && octave_ver_less_than('6')
-        [observable_pos_requested_vars, index_subset, index_observables] = intersect_stable(ivar, options_.varobs_id);
-    else
-        [observable_pos_requested_vars, index_subset, index_observables] = intersect(ivar, options_.varobs_id, 'stable');
-    end
+    [observable_pos_requested_vars, index_subset, index_observables] = intersect(ivar, options_.varobs_id, 'stable');
     if ~isempty(observable_pos_requested_vars)
         ME_present=1;
         i_ME = setdiff([1:size(M_.H,1)],find(diag(M_.H) == 0)); % find ME with 0 variance
diff --git a/matlab/disp_th_moments.m b/matlab/disp_th_moments.m
index 3c8466c512a07dab7f304f91d79d7d3279aaa634..87d51522d97a63ad1188b07ab29ba8df023734b3 100644
--- a/matlab/disp_th_moments.m
+++ b/matlab/disp_th_moments.m
@@ -2,7 +2,7 @@ function oo_ = disp_th_moments(dr, var_list, M_, options_, oo_)
 
 % Display theoretical moments of variables
 
-% Copyright (C) 2001-2020 Dynare Team
+% Copyright (C) 2001-2021 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -55,11 +55,7 @@ oo_.var = oo_.gamma_y{1};
 
 ME_present=0;
 if ~all(diag(M_.H)==0)
-    if isoctave && octave_ver_less_than('6')
-        [observable_pos_requested_vars,index_subset,index_observables]=intersect_stable(ivar,options_.varobs_id);
-    else
-        [observable_pos_requested_vars,index_subset,index_observables]=intersect(ivar,options_.varobs_id,'stable');
-    end
+    [observable_pos_requested_vars,index_subset,index_observables]=intersect(ivar,options_.varobs_id,'stable');
     if ~isempty(observable_pos_requested_vars)
         ME_present=1;
     end
@@ -106,11 +102,7 @@ if size(stationary_vars, 1) > 0
             lh = cellofchararraymaxlength(labels)+2;
             dyntable(options_, title, headers, labels, 100*oo_.gamma_y{options_.ar+2}(stationary_vars,:), lh, 8, 2);
             if ME_present
-                if isoctave && octave_ver_less_than('6')
-                    [stationary_observables, pos_index_subset] = intersect_stable(index_subset, stationary_vars);
-                else
-                    [stationary_observables, pos_index_subset] = intersect(index_subset, stationary_vars, 'stable');
-                end
+                [stationary_observables, pos_index_subset] = intersect(index_subset, stationary_vars, 'stable');
                 headers_ME = vertcat(headers, 'ME');
                 labels=get_labels_transformed_vars(M_.endo_names,ivar(stationary_observables),options_,false);
                 dyntable(options_, [title,' WITH MEASUREMENT ERROR'], headers_ME, labels, ...
@@ -213,4 +205,4 @@ if options_.ar > 0 && size(stationary_vars, 1) > 0
             dyn_latex_table(M_, options_, title, 'th_autocorr_matrix', headers, labels, z, lh, 8, 4);
         end
     end
-end
\ No newline at end of file
+end
diff --git a/matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m b/matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m
index a4722c83243babc1853da71b108e08b22f116fd6..23cdfdff190133667aaf380385b2687096435a02 100644
--- a/matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m
+++ b/matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m
@@ -19,7 +19,7 @@ function [nvar,vartan,NumberOfConditionalDecompFiles] = ...
 %   vartan                           [char]     array of characters (with nvar rows).
 %   NumberOfConditionalDecompFiles   [integer]  scalar, number of prior or posterior data files (for covariance).
 
-% Copyright (C) 2009-2020 Dynare Team
+% Copyright (C) 2009-2021 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -84,11 +84,7 @@ MaXNumberOfConditionalDecompLines = ceil(options_.MaxNumberOfBytes/NumberOfSaved
 
 ME_present=0;
 if ~all(diag(M_.H)==0)
-    if isoctave && octave_ver_less_than('6')
-        [observable_pos_requested_vars,index_subset,index_observables]=intersect_stable(ivar,options_.varobs_id);
-    else
-        [observable_pos_requested_vars,index_subset,index_observables]=intersect(ivar,options_.varobs_id,'stable');
-    end
+    [observable_pos_requested_vars,index_subset,index_observables]=intersect(ivar,options_.varobs_id,'stable');
     if ~isempty(observable_pos_requested_vars)
         ME_present=1;
         nobs_ME=length(observable_pos_requested_vars);
diff --git a/matlab/dsge_simulated_theoretical_variance_decomposition.m b/matlab/dsge_simulated_theoretical_variance_decomposition.m
index 5f083438e541785bdd544a2f9ca02b36e38a4b7d..e17865aaeb5d9e7ad49ae38e236074f32b79a96a 100644
--- a/matlab/dsge_simulated_theoretical_variance_decomposition.m
+++ b/matlab/dsge_simulated_theoretical_variance_decomposition.m
@@ -18,7 +18,7 @@ function [nvar,vartan,NumberOfDecompFiles] = ...
 %   vartan            [char]     array of characters (with nvar rows).
 %   CovarFileNumber   [integer]  scalar, number of prior or posterior data files (for covariance).
 
-% Copyright (C) 2007-2020 Dynare Team
+% Copyright (C) 2007-2021 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -87,11 +87,7 @@ MaXNumberOfDecompLines = ceil(options_.MaxNumberOfBytes/NumberOfSavedElementsPer
 
 ME_present=0;
 if ~all(diag(M_.H)==0)
-    if isoctave && octave_ver_less_than('6')
-        [observable_pos_requested_vars,index_subset,index_observables]=intersect_stable(ivar,options_.varobs_id);
-    else
-        [observable_pos_requested_vars,index_subset,index_observables]=intersect(ivar,options_.varobs_id,'stable');
-    end
+    [observable_pos_requested_vars,index_subset,index_observables]=intersect(ivar,options_.varobs_id,'stable');
     if ~isempty(observable_pos_requested_vars)
         ME_present=1;
         nobs_ME=length(observable_pos_requested_vars);
diff --git a/matlab/dynare.m b/matlab/dynare.m
index 4df698911f1d899664e4a4c016f39800faf39976..57bff4d1841ede9b31682260037fd3ed8fa9dd4a 100644
--- a/matlab/dynare.m
+++ b/matlab/dynare.m
@@ -76,9 +76,9 @@ if isoctave
                  'of precompiled mex files and some\nfeatures, like solution ' ...
                  'of models approximated at third order, will not be available.'], supported_octave_version())
         skipline()
-    elseif octave_ver_less_than('4.4') % Should match the test in mex/build/octave/configure.ac
+    elseif octave_ver_less_than('6.2.0') % Should match the test in mex/build/octave/configure.ac, and also the one in matlab/modules/dseries/src/initialize_dseries_class.m
         skipline()
-        warning(['This version of Dynare has only been tested on Octave 4.4 and above. Dynare may fail to run or give unexpected result. Consider upgrading your version of Octave.'])
+        warning(['This version of Dynare has only been tested on Octave 6.2.0 and above. Dynare may fail to run or give unexpected result. Consider upgrading your version of Octave.'])
         skipline()
     end
 else
diff --git a/matlab/dynare_config.m b/matlab/dynare_config.m
index 4d939085256657a1e4044faa932c136c6e4e6a4d..71441e1f1a573ab2ed9cf7da693384bbc97a8b6f 100644
--- a/matlab/dynare_config.m
+++ b/matlab/dynare_config.m
@@ -85,17 +85,6 @@ if ~isoctave
     p{end+1} = '/missing/vec';
 end
 
-% ordeig() doesn't exist in Octave < 5
-if isoctave && octave_ver_less_than('5')
-    p{end+1} = '/missing/ordeig';
-end
-
-%% intersect(…, 'stable') and unique(…, 'stable') doen't exist in Octave < 6
-if isoctave && octave_ver_less_than('6')
-    p{end+1} = '/missing/intersect_stable';
-    p{end+1} = '/missing/unique_stable';
-end
-
 % Replacements for functions of the MATLAB statistics toolbox
 if isoctave
     % Under Octave, these functions are in the statistics Forge package.
@@ -115,8 +104,8 @@ if ~exist('struct2array')
     p{end+1} = '/missing/struct2array';
 end
 
-% isfile is missing in Octave < 5 and Matlab < R2017b
-if (isoctave && octave_ver_less_than('5')) || (~isoctave && matlab_ver_less_than('9.3'))
+% isfile is missing in MATLAB < R2017b
+if ~isoctave && matlab_ver_less_than('9.3')
     p{end+1} = '/missing/isfile';
 end
 
diff --git a/matlab/lmmcp/catstruct.m b/matlab/lmmcp/catstruct.m
index a021b3ba3c592509f97d83ef224c553d0db75722..6354225bd594728ed3a9158dfa883664299fba58 100644
--- a/matlab/lmmcp/catstruct.m
+++ b/matlab/lmmcp/catstruct.m
@@ -48,7 +48,7 @@ function A = catstruct(varargin)
 
 % Copyright (C) 2005 Jos van der Geest <jos@jasen.nl>
 % Copyright (C) 2013 Christophe Gouel
-% Copyright (C) 2016-2020 Dynare Team
+% Copyright (C) 2016-2021 Dynare Team
 %
 % Redistribution and use in source and binary forms, with or without
 % modification, are permitted provided that the following conditions are
@@ -150,11 +150,7 @@ else
     FN = squeeze(FN) ;
     VAL = squeeze(VAL) ;
     MatlabVersion = version;
-    if isoctave && octave_ver_less_than('6')
-        [UFN,ind] = unique(FN) ;
-    else
-        [UFN,ind] = unique(FN,'legacy') ;
-    end
+    [UFN,ind] = unique(FN,'legacy') ;
 
     if numel(UFN) ~= numel(FN)
         warning('catstruct:DuplicatesFound','Fieldnames are not unique between structures.') ;
diff --git a/matlab/missing/intersect_stable/intersect_stable.m b/matlab/missing/intersect_stable/intersect_stable.m
deleted file mode 100644
index 9b6eb543358d263a41adf24e7b07dc0b497c685f..0000000000000000000000000000000000000000
--- a/matlab/missing/intersect_stable/intersect_stable.m
+++ /dev/null
@@ -1,91 +0,0 @@
-% Crude implementation of intersect(…, 'stable'), which is missing in Octave
-
-% Copyright (C) 2019 Dynare Team
-%
-% This file is part of Dynare.
-%
-% Dynare is free software: you can redistribute it and/or modify
-% it under the terms of the GNU General Public License as published by
-% the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
-%
-% Dynare is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-% GNU General Public License for more details.
-%
-% You should have received a copy of the GNU General Public License
-% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
-
-function [c, ia, ib] = intersect_stable(a, b)
-
-if nargin ~= 2
-    error('intersect_stable: needs exactly 2 input arguments');
-end
-
-if isnumeric (a) && isnumeric (b)
-    c = [];
-elseif iscell (b)
-    c = {};
-else
-    c = '';
-end
-ia = [];
-ib = [];
-
-if isempty (a) || isempty (b)
-    return
-else
-    isrowvec = isrow (a) && isrow (b);
-
-    for i = 1:numel(a)
-        if iscellstr(c)
-            idx = strcmp(a(i), b);
-        else
-            idx = a(i) == b;
-        end
-        if any(idx) && ~ismember(a(i), c)
-            c = [c(:); a(i)];
-            if nargout > 1
-                ia = [ia, i];
-                ib = [ib, find(idx)];
-            end
-        end
-    end
-
-    %% Adjust output orientation for MATLAB compatibility
-    if isrowvec
-        c = c.';
-    end
-end
-end
-
-%!test
-%! a = [3 4 1 5];
-%! b = [2 4 9 1 6];
-%! [c,ia,ib]=intersect_stable(a,b);
-%! assert(c, [4 1])
-%! assert(ia, [2 3])
-%! assert(ib, [2 4])
-%! assert(a(ia), c)
-%! assert(b(ib), c)
-
-%!test
-%! a = [3 4 1 5]';
-%! b = [2 4 9 1 6]';
-%! [c,ia,ib]=intersect_stable(a,b);
-%! assert(c, [4 1]')
-%! assert(ia, [2 3])
-%! assert(ib, [2 4])
-%! assert(a(ia), c)
-%! assert(b(ib), c)
-
-%!test
-%! a = { 'defun', 'mapcar', 'let', 'eval-when'};
-%! b = { 'setf', 'let', 'list', 'cdr', 'defun'};
-%! [c,ia,ib]=intersect_stable(a,b);
-%! assert(c, { 'defun', 'let' })
-%! assert(ia, [1 3])
-%! assert(ib, [5 2])
-%! assert(a(ia), c)
-%! assert(b(ib), c)
diff --git a/matlab/missing/ordeig/ordeig.m b/matlab/missing/ordeig/ordeig.m
deleted file mode 100644
index e7ddfd744f9a876a348fa103ce472961420c49fc..0000000000000000000000000000000000000000
--- a/matlab/missing/ordeig/ordeig.m
+++ /dev/null
@@ -1,46 +0,0 @@
-function eigs = ordeig(t)
-% function eval = ordeig(t)
-% Computes the eigenvalues of a quasi-triangular matrix
-%
-% INPUTS
-%    t:              quasi-triangular matrix
-%
-% OUTPUTS
-%    eigs:           eigenvalues
-%
-% SPECIAL REQUIREMENTS
-%    none
-
-% Copyright (C) 2003-2017 Dynare Team
-%
-% This file is part of Dynare.
-%
-% Dynare is free software: you can redistribute it and/or modify
-% it under the terms of the GNU General Public License as published by
-% the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
-%
-% Dynare is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-% GNU General Public License for more details.
-%
-% You should have received a copy of the GNU General Public License
-% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
-
-n = size(t,2);
-eigs = zeros(n,1);
-i = 1;
-while i <= n
-    if i == n
-        eigs(n) = t(n,n);
-        break
-    elseif t(i+1,i) == 0
-        eigs(i) = t(i,i);
-        i = i+1;
-    else
-        k = i:i+1;
-        eigs(k) = eig(t(k,k));
-        i = i+2;
-    end
-end
diff --git a/matlab/missing/unique_stable/unique_stable.m b/matlab/missing/unique_stable/unique_stable.m
deleted file mode 100644
index 38ad69ee2965f054b8c9649b9ff57c9802fda649..0000000000000000000000000000000000000000
--- a/matlab/missing/unique_stable/unique_stable.m
+++ /dev/null
@@ -1,44 +0,0 @@
-% Crude implementation of unique(…, 'stable'), which is missing in Octave < 6
-
-% Copyright (C) 2021 Dynare Team
-%
-% This file is part of Dynare.
-%
-% Dynare is free software: you can redistribute it and/or modify
-% it under the terms of the GNU General Public License as published by
-% the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
-%
-% Dynare is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-% GNU General Public License for more details.
-%
-% You should have received a copy of the GNU General Public License
-% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
-
-function [r, idx] = unique_stable(x)
-
-idx = [];
-
-if iscell(x)
-    r = {};
-    for i = 1:numel(x)
-        if ~ismember(x{i}, r)
-            r{end+1} = x{i};
-            idx(end+1) = i;
-        end
-    end
-else
-    r = [];
-    for i = 1:numel(x)
-        if ~ismember(x(i), r)
-            r(end+1) = x(i);
-            idx(end+1) = i;
-        end
-    end
-end
-
-if size(x, 2) == 1
-    r = r';
-end
diff --git a/matlab/modules/dseries b/matlab/modules/dseries
index 479460fee64681232b696745c9f3319700def1de..a02a4ce6745c1e23ff9aaedd4db651c1acf3cd47 160000
--- a/matlab/modules/dseries
+++ b/matlab/modules/dseries
@@ -1 +1 @@
-Subproject commit 479460fee64681232b696745c9f3319700def1de
+Subproject commit a02a4ce6745c1e23ff9aaedd4db651c1acf3cd47
diff --git a/matlab/ols/getEquationsByTags.m b/matlab/ols/getEquationsByTags.m
index 7d7c85b91211a7f9f12fca3ebe55a0514011bb98..7addcc116b4fb8b2a3c486ad962ee2f1547ad510 100644
--- a/matlab/ols/getEquationsByTags.m
+++ b/matlab/ols/getEquationsByTags.m
@@ -72,9 +72,5 @@ for i = 1:length(tagvalue)
     end
 end
 assert(~isempty(idx2keep), 'getEquationsByTags: no equations selected');
-if isoctave && octave_ver_less_than('6')
-    ast = ast(unique_stable(idx2keep));
-else
-    ast = ast(unique(idx2keep, 'stable'));
-end
+ast = ast(unique(idx2keep, 'stable'));
 end
diff --git a/matlab/posterior_analysis.m b/matlab/posterior_analysis.m
index 453d3b5d66351c19368b9aa54b43f88e78849a21..6f537e43b6c378415d82982326b29d5a50441e7a 100644
--- a/matlab/posterior_analysis.m
+++ b/matlab/posterior_analysis.m
@@ -1,6 +1,6 @@
 function oo_ = posterior_analysis(type,arg1,arg2,arg3,options_,M_,oo_)
 
-% Copyright (C) 2008-2020 Dynare Team
+% Copyright (C) 2008-2021 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -66,11 +66,7 @@ switch type
                                              M_.exo_names,arg2,vartan,arg1,options_.mh_conf_sig,oo_,options_);
     if ~all(diag(M_.H)==0)
         if strmatch(arg1,options_.varobs,'exact')
-            if isoctave && octave_ver_less_than('6')
-                [observable_name_requested_vars,index_subset,index_observables]=intersect_stable(vartan,options_.varobs);
-            else
-                [observable_name_requested_vars,index_subset,index_observables]=intersect(vartan,options_.varobs,'stable');
-            end
+            [observable_name_requested_vars,index_subset,index_observables]=intersect(vartan,options_.varobs,'stable');
             oo_ = variance_decomposition_ME_mc_analysis(SampleSize,'posterior',M_.dname,M_.fname,...
                                                         [M_.exo_names;'ME'],arg2,observable_name_requested_vars,arg1,options_.mh_conf_sig,oo_,options_);
         end
diff --git a/mex/build/octave/configure.ac b/mex/build/octave/configure.ac
index fd24cb3d6a21fe1dfc672ad820dac508dad5a469..b9ffc14ce25e084e92fe9515dd74b2c311b96d4f 100644
--- a/mex/build/octave/configure.ac
+++ b/mex/build/octave/configure.ac
@@ -39,7 +39,7 @@ LDFLAGS="$($MKOCTFILE -p LFLAGS) $($MKOCTFILE -p LDFLAGS)"
 AC_CANONICAL_HOST
 
 OCTAVE_VERSION=$($MKOCTFILE -v 2>&1 | sed 's/mkoctfile, version //')
-AX_COMPARE_VERSION([$OCTAVE_VERSION], [lt], [4.4], [AC_MSG_ERROR([Your Octave is too old, please upgrade to version 4.4 at least (or disable Octave support with --disable-octave).])])
+AX_COMPARE_VERSION([$OCTAVE_VERSION], [lt], [6.2.0], [AC_MSG_ERROR([Your Octave is too old, please upgrade to version 6.2.0 at least (or disable Octave support with --disable-octave).])])
 
 AC_PROG_FC
 AC_PROG_CC
diff --git a/tests/bgp/fs2000/fs2000.mod b/tests/bgp/fs2000/fs2000.mod
index c7f6fd94f63abeb65eed1f927eb95bfc5efa70a4..bbe593f348cba72909b9c7705ca817b58ce8c4fd 100644
--- a/tests/bgp/fs2000/fs2000.mod
+++ b/tests/bgp/fs2000/fs2000.mod
@@ -7,7 +7,7 @@
  */
 
 /*
- * Copyright (C) 2019 Dynare Team
+ * Copyright (C) 2019-2021 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -72,14 +72,7 @@ verbatim;
     else
         options = optimoptions('fsolve','Display','iter','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-6,'StepTolerance',1e-6);
     end
-    if isoctave && octave_ver_less_than('6')
-        % Octave < 6 can't take a function handle of a function in a package
-        % See https://savannah.gnu.org/bugs/index.php?46659
-        fun = str2func('fs2000.bgpfun');
-    else
-        fun = @fs2000.bgpfun;
-    end
-    [y, fval, exitflag] = fsolve(fun, [y;g], options);
+    [y, fval, exitflag] = fsolve(@fs2000.bgpfun, [y;g], options);
     if exitflag<1
         error('Solution not found')
     end
diff --git a/tests/bgp/nk-1/nk.mod b/tests/bgp/nk-1/nk.mod
index a77a1b3daf4bd476dad22565209ee79b3c71be1c..32f8ec25fe860da5c898fb50e4fb6cc088da561f 100644
--- a/tests/bgp/nk-1/nk.mod
+++ b/tests/bgp/nk-1/nk.mod
@@ -29,16 +29,9 @@ verbatim;
     else
         options = optimoptions('fsolve','Display','iter','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-8,'StepTolerance',1e-8);
     end
-    if isoctave && octave_ver_less_than('6')
-        % Octave < 6 can't take a function handle of a function in a package
-        % See https://savannah.gnu.org/bugs/index.php?46659
-        fun = str2func('nk.bgpfun');
-    else
-        fun = @nk.bgpfun;
-    end
     y = 1+(rand(3,1)-.5)*.5;
     g = 1+(rand(3,1)-.5)*.1;
-    [y, fval, exitflag] = fsolve(fun, [y;g], options);
+    [y, fval, exitflag] = fsolve(@nk.bgpfun, [y;g], options);
     assert(max(abs(y-1))<1e-9);
 
 end;
diff --git a/tests/bgp/ramsey-1/ramsey.mod b/tests/bgp/ramsey-1/ramsey.mod
index 27b69322aad9d517519b855894126907d97f3775..b461f6fcadb7188abc114f80ea6e15dc9fd6cecf 100644
--- a/tests/bgp/ramsey-1/ramsey.mod
+++ b/tests/bgp/ramsey-1/ramsey.mod
@@ -24,16 +24,9 @@ verbatim;
     else
         options = optimoptions('fsolve','Display','iter','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-6,'StepTolerance',1e-6);
     end
-    if isoctave && octave_ver_less_than('6')
-        % Octave < 6 can't take a function handle of a function in a package
-        % See https://savannah.gnu.org/bugs/index.php?46659
-        fun = str2func('ramsey.bgpfun');
-    else
-        fun = @ramsey.bgpfun;
-    end
     y = 1+(rand(M_.endo_nbr,1)-.5)*.25;
     g = ones(M_.endo_nbr,1);% 1+(rand(M_.endo_nbr,1)-.5)*.1;
-    [y, fval, exitflag] = fsolve(fun, [y;g], options);
+    [y, fval, exitflag] = fsolve(@ramsey.bgpfun, [y;g], options);
     assert(max(abs(y(M_.endo_nbr+(1:M_.orig_endo_nbr))-1.02))<1e-6)
 
 end;
diff --git a/tests/bgp/solow-1/solow.mod b/tests/bgp/solow-1/solow.mod
index 3f8daed2508af28579377ba6c2581b7d6773f668..c5e26af321ec5d21803cc46804b86843b33a1ec5 100644
--- a/tests/bgp/solow-1/solow.mod
+++ b/tests/bgp/solow-1/solow.mod
@@ -55,18 +55,11 @@ verbatim;
     else
         options = optimoptions('fsolve','Display','off','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-8,'StepTolerance',1e-8);
     end
-    if isoctave && octave_ver_less_than('6')
-        % Octave < 6 can't take a function handle of a function in a package
-        % See https://savannah.gnu.org/bugs/index.php?46659
-        fun = str2func('solow.bgpfun');
-    else
-        fun = @solow.bgpfun;
-    end
     reverseStr = '';
     for i=1:MC
         y = 1+(rand(6,1)-.5)*.2;
         g = ones(6,1);
-        [y, fval, exitflag] = fsolve(fun, [y;g], options);
+        [y, fval, exitflag] = fsolve(@solow.bgpfun, [y;g], options);
         if exitflag>0
             KY(i) = y(6)/y(5);
             GY(i) = y(11);
diff --git a/tests/conditional_variance_decomposition/example1.mod b/tests/conditional_variance_decomposition/example1.mod
index 880a465e8ba433126f9a46d21cefb324682615a5..867864b16eff4af173c450ac3ae8baf30536c67b 100644
--- a/tests/conditional_variance_decomposition/example1.mod
+++ b/tests/conditional_variance_decomposition/example1.mod
@@ -76,11 +76,7 @@ for i=1:nvar
     SubsetOfVariables(i) = i_tmp;
 end
 
-if isoctave && octave_ver_less_than('6')
-    [observable_pos,index_observables,index_subset]=intersect_stable(SubsetOfVariables,options_.varobs_id);
-else
-    [observable_pos,index_observables,index_subset]=intersect(SubsetOfVariables,options_.varobs_id,'stable');
-end
+[observable_pos,index_observables,index_subset]=intersect(SubsetOfVariables,options_.varobs_id,'stable');
 y_pos=strmatch('y',var_list_,'exact');
 y_pos_varobs=strmatch('y',options_.varobs,'exact');
 a_pos_varobs=strmatch('a',options_.varobs,'exact');
@@ -114,11 +110,7 @@ if max(abs(sum(oo_.variance_decomposition,2)-100))>2
     error(['Variance decomposition at order ',num2str(options_.order),' does not work'])
 end
 
-if isoctave && octave_ver_less_than('6')
-    [observable_pos,index_observables,index_subset]=intersect_stable(SubsetOfVariables,options_.varobs_id);
-else
-    [observable_pos,index_observables,index_subset]=intersect(SubsetOfVariables,options_.varobs_id,'stable');
-end
+[observable_pos,index_observables,index_subset]=intersect(SubsetOfVariables,options_.varobs_id,'stable');
 y_pos=strmatch('y',var_list_,'exact');
 y_pos_varobs=strmatch('y',options_.varobs,'exact');
 a_pos_varobs=strmatch('a',options_.varobs,'exact');
diff --git a/tests/stochastic_purely_forward/stochastic_purely_forward.mod b/tests/stochastic_purely_forward/stochastic_purely_forward.mod
index 6dd03fcafc257731a4828a9186da0bf4906ad982..9370e6ab7db16571dbb221c73eeb7c2b43f43578 100644
--- a/tests/stochastic_purely_forward/stochastic_purely_forward.mod
+++ b/tests/stochastic_purely_forward/stochastic_purely_forward.mod
@@ -19,15 +19,8 @@ end;
 steady;
 check;
 
-% Skip test under Octave 5.1
-% ordeig() is buggy in that version (but is fixed in later ones; and in older
-% ones it is absent, so we use our replacement)
-if ~isoctave || octave_ver_less_than('5.1') || ~octave_ver_less_than('5.2')
-
 stoch_simul(periods=0, irf=30, order=1);
 stoch_simul(periods=2000, irf=30, order=1);
 
 stoch_simul(periods=0, irf=30, order=1,hp_filter=1600);
 stoch_simul(periods=2000, irf=30, order=1,hp_filter=1600);
-
-end
diff --git a/tests/stochastic_purely_forward/stochastic_purely_forward_with_static.mod b/tests/stochastic_purely_forward/stochastic_purely_forward_with_static.mod
index 8622d890f1ad4986a31d3aae816d7031393fb176..537416bad553a95ead16468dff943ac8b296fac1 100644
--- a/tests/stochastic_purely_forward/stochastic_purely_forward_with_static.mod
+++ b/tests/stochastic_purely_forward/stochastic_purely_forward_with_static.mod
@@ -20,15 +20,8 @@ end;
 steady;
 check;
 
-% Skip test under Octave 5.1
-% ordeig() is buggy in that version (but is fixed in later ones; and in older
-% ones it is absent, so we use our replacement)
-if ~isoctave || octave_ver_less_than('5.1') || ~octave_ver_less_than('5.2')
-
 stoch_simul(periods=0, irf=30, order=1);
 stoch_simul(periods=2000, irf=30, order=1);
 
 stoch_simul(periods=0, irf=30, order=1,hp_filter=1600);
 stoch_simul(periods=2000, irf=30, order=1,hp_filter=1600);
-
-end