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: smoothMeshFunction.m
    path of file: ./repos/matGeom/matGeom/meshes3d
    
    the code of the file until where you have to start completion: function f = smoothMeshFunction(vertices, faces, f, varargin) %#ok<INUSL>
%SMOOTHMESHFUNCTION Apply smoothing on a functions defines on mesh vertices.
%
%   FS = smoothMeshFunction(VERTICES, FACES, F, NITERS)
%   Performs smoothing on the function F defined on vertices of the mesh.
%   The mesh is specified by VERTICES and FACES array. At each iteration,

    
function f = smoothMeshFunction(vertices, faces, f, varargin) %#ok<INUSL>
%SMOOTHMESHFUNCTION Apply smoothing on a functions defines on mesh vertices.
%
%   FS = smoothMeshFunction(VERTICES, FACES, F, NITERS)
%   Performs smoothing on the function F defined on vertices of the mesh.
%   The mesh is specified by VERTICES and FACES array. At each iteration,
%   the value for each vertex is obtained as the average of values obtained
%   from neighbor vertices.
%   NITERS is the number of times the iteration must be repeated. By
%   default it equals 3.
%
%   Example
%   smoothMeshFunction
%
%   See also 
%     meshes3d, meshCurvatures

% ------
% Author: David Legland
% E-mail: david.legland@inrae.fr
% Created: 2021-09-22, using Matlab 9.10.0.1684407 (R2021a) Update 3
% Copyright 2021-2023 INRAE - BIA Research Unit - BIBS Platform (Nantes)

% determines number of iterations
nIters = 3;
if ~isempty(varargin)
    nIters = varargin{1};
end