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: getSmoothing.m
    path of file: ./repos/CanlabCore/CanlabCore/OptimizeDesign11/core_functions
    
    the code of the file until where you have to start completion: function [S, Vi, svi, KH, xc] = getSmoothing(HPlength, LPsmooth, TR,numsamps, xc, varargin)
% [S,Vi,svi,KH] = getSmoothing(HPlength, LPsmooth, TR, numsamps, xc, [sessions])
%
% Inputs
% 	HPlength: 	high-pass filter length in s, or [] for none
%	LPsmooth: 	low-pass filter with hrf, 1 (yes) or 0 (no)
%	TR:			repetition time
%	numsamps:	number of scans in session
%	xc:			custom autocorrelation function, [] for white noise, 'auto'

    
function [S, Vi, svi, KH, xc] = getSmoothing(HPlength, LPsmooth, TR,numsamps, xc, varargin)
% [S,Vi,svi,KH] = getSmoothing(HPlength, LPsmooth, TR, numsamps, xc, [sessions])
%
% Inputs
% 	HPlength: 	high-pass filter length in s, or [] for none
%	LPsmooth: 	low-pass filter with hrf, 1 (yes) or 0 (no)
%	TR:			repetition time
%	numsamps:	number of scans in session
%	xc:			custom autocorrelation function, [] for white noise, 'auto'
%	            for canonical 1/f function
%
% Outputs
%	S			smoothing filter, apply using S * X
%	Vi			intrinsic autocorrelation matrix
%	svi			S * Vi * S';
%   KH          High-pass filter matrix
%   xc          Autocorrelation function that goes into Vi
%
% Tor Wager, 11/17/01

% Programmers' notes
% modified 2/24/04 to speed processing with < 3 output arguments.
% 2021 Dec : minor cleanup of code, removed extraneous x output code 

% ----------------------------------------------------------------
% * get smoothing matrix and autocorrelation matrix
% ----------------------------------------------------------------
if isempty(HPlength),HPlength = 'none'; end