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_plot_dipole.m
    path of file: ./repos/fecgsyn/subfunctions/data-generation/libs/fieldtrip/plotting
    
    the code of the file until where you have to start completion: function h = ft_plot_dipole(pos, ori, varargin)

% FT_PLOT_DIPOLE makes a 3-D representation of a dipole using a sphere and a stick
% pointing along the dipole orientation
%
% Use as
%   ft_plot_dipole(pos, mom, ...)
% where pos and mom are the dipole mosition and moment.
%
% Optional input arguments should be specified in key-value pairs and can include
%   'diameter'  = number indicating sphere diameter (default = 'auto')
%   'length'    = number indicating length of the stick (default = 'auto')
%   'thickness' = number indicating thickness of the stick (default = 'auto')
%   'color'     = [r g b] values or string, for example 'brain', 'cortex', 'skin', 'black', 'red', 'r' (default = 'r')
%   'unit'      = 'm', 'cm' or 'mm', used for automatic scaling (default = 'cm')
%   'scale'     = scale the dipole with the amplitude, can be 'none',  'both', 'diameter', 'length' (default = 'none')
%   'alpha'     = alpha value of the plotted dipole
%
% Example
%   ft_plot_dipole([0 0 0], [1 2 3], 'color', 'r', 'alpha', 1)
%
% See also FT_PLOT_MESH, FT_PLOT_ORTHO

% Copyright (C) 2009-2018, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org

    
function h = ft_plot_dipole(pos, ori, varargin)

% FT_PLOT_DIPOLE makes a 3-D representation of a dipole using a sphere and a stick
% pointing along the dipole orientation
%
% Use as
%   ft_plot_dipole(pos, mom, ...)
% where pos and mom are the dipole mosition and moment.
%
% Optional input arguments should be specified in key-value pairs and can include
%   'diameter'  = number indicating sphere diameter (default = 'auto')
%   'length'    = number indicating length of the stick (default = 'auto')
%   'thickness' = number indicating thickness of the stick (default = 'auto')
%   'color'     = [r g b] values or string, for example 'brain', 'cortex', 'skin', 'black', 'red', 'r' (default = 'r')
%   'unit'      = 'm', 'cm' or 'mm', used for automatic scaling (default = 'cm')
%   'scale'     = scale the dipole with the amplitude, can be 'none',  'both', 'diameter', 'length' (default = 'none')
%   'alpha'     = alpha value of the plotted dipole
%
% Example
%   ft_plot_dipole([0 0 0], [1 2 3], 'color', 'r', 'alpha', 1)
%
% See also FT_PLOT_MESH, FT_PLOT_ORTHO

% Copyright (C) 2009-2018, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
%    FieldTrip is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    FieldTrip is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

ws = ft_warning('on', 'MATLAB:divideByZero');

% get the optional input arguments
amplitudescale = ft_getopt(varargin, 'scale',     'none');
color          = ft_getopt(varargin, 'color',     'r'); % can also be a RGB triplet
diameter       = ft_getopt(varargin, 'diameter',  'auto');
length         = ft_getopt(varargin, 'length',    'auto');
thickness      = ft_getopt(varargin, 'thickness', 'auto');
unit           = ft_getopt(varargin, 'unit',      'cm');
alpha          = ft_getopt(varargin, 'alpha',      1);

% for backward compatibility, this can be changed into an error at the end