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: ft_freqinterpolate.m
    path of file: ./repos/fecgsyn/subfunctions/data-generation/libs/fieldtrip
    
    the code of the file until where you have to start completion: function [freq] = ft_freqinterpolate(cfg, freq)

% FT_FREQINTERPOLATE interpolates frequencies by looking at neighbouring
% values or simply replaces a piece in the spectrum by NaN.

    
function [freq] = ft_freqinterpolate(cfg, freq)

% FT_FREQINTERPOLATE interpolates frequencies by looking at neighbouring
% values or simply replaces a piece in the spectrum by NaN.
%
% Use as
%   freq = ft_freqinterpolate(cfg, freq)
% where freq is the output of FT_FREQANALYSIS or FT_FREQDESCRIPTIVES and the
% configuration may contain
%   cfg.method   = 'nan', 'linear' (default = 'nan')
%   cfg.foilim   = Nx2 matrix with begin and end