You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: SmoothingPoints2d_Excess.m
    path of file: ./repos/d2d/arFramework3/PL2D/Subfunctions_autofix
    
    the code of the file until where you have to start completion: function [indxs,indys,dirs,margin] = SmoothingPoints2d_Excess(lbub,output_msg)

% [indys,dirs,indxs,margin] = SmoothingPoints2d_Excess(lbub,output_msg)
%
% This function lists all lower (lbub = -1) or upper (lbub = 1) parameter 
% bound values and finds possible jumps depending on unusual 
% (i.e. discontinuous) behavior of the bounds. If
    
function comments for additional information.
%
% See also: rmProfileJumps2d , SmoothingPoints2d_Bounds,
% SmoothingPoints2d_Inside

if ~exist('lbub','var') || isempty(lbub)
    fprintf(['\n ERROR SmoothingPoints2d_Excess: \n Please specify',...
        ' whether lower (lbub = -1) or upper (lbub = 1) is of interest. \n']);
    return
end
if ~exist('output_msg','var') || isempty(output_msg)
    output_msg = 1;
end

global ar

jumpfactor = ar.ple2d.config.autofix.jumpfactor;
scalefactor = ar.ple2d.config.autofix.scalefactor;

smooth2d;

n = length(ar.ple2d.raw.predsteps);
thresh = scalefactor*(max(ar.ple2d.raw.plpar,[],'all') ...
    - min(ar.ple2d.raw.plpar,[],'all'));

% Lower or Upper bound:
if lbub == -1
    bounds = min(ar.ple2d.raw.plpar);
    txt = 'lower';
elseif lbub == 1
    bounds = max(ar.ple2d.raw.plpar);
    txt = 'upper';
end