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: surf.m
    path of file: ./repos/chebfun/@spherefun
    
    the code of the file until where you have to start completion: function varargout = surf(f, varargin)
%SURF  Surface plot of a SPHEREFUN.
%   SURF(F) plots F on the surface of a sphere.
%
%   SURF(..., 'GRID', S) plots F on the surface of a sphere and includes a
%   grid with standard line properties specifed by the string S.
%
%   SURF(..., 'PROJECTION', type) plots F using one of the following map
%   projections specified by the string type
    
function values.
            scl = 0.15;
            vv = vv + rescale(C, -scl, scl); % Only bump out by scl.
            lim = lim + [-scl scl];          % Pad the axis limits.
        end
        [xx,yy,zz] = sph2cart(ll,pi/2 - tt,vv);
        h = surf(xx, yy, zz, C, defaultOpts{:}, argin{:});
        if addGrid == 1
            [xxg,yyg,zzg] = sph2cart(llgl,pi/2-ttgl,1+0*llgl);
            hold on;
            plot3(xxg,yyg,zzg,gridLineType);
            [xxg,yyg,zzg] = sph2cart(llgt,pi/2-ttgt,1+0*llgt);
            plot3(xxg',yyg',zzg',gridLineType);
            if ~plotOnHold
                hold off;
            end