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: sigm.m
    path of file: ./repos/PsPM/src/ext/VBA/subfunctions
    
    the code of the file until where you have to start completion: function [Sx,dsdx,dsdp] = sigm(x,in,Phi)
% evaluates the sigmoid function (weird parameterization)
% function [Sx,dsdx,dsdp] = sigm(x,in,Phi)
% IN:

    
function [Sx,dsdx,dsdp] = sigm(x,in,Phi)
% evaluates the sigmoid function (weird parameterization)
% function [Sx,dsdx,dsdp] = sigm(x,in,Phi)
% IN:
%   - x: the value at which the sigmoid function is evaluated. Can be a
%   vector, in which case the output is also a (row) vector.
%   - in: a structure that contains some default gains:
%       .G0: is the factor by which the sigmoid function is scaled ({1})
%       .S0: is the intercept ({0})
%       .beta: is the default slope of the sigmoid ({1})
%       .INV: if 1, the function evaluates the inverse sigmoid function
%       (this means sigm(sigm(x,struct('INV',1))) = x)
%       .mat: if 1, do not vectorize x
%   - Phi: A vector, can be left unspecified, or contain one or two
%   entries. The first entry rescale the slope in.beta ({0}); the second is
%   the inflexion point ({0})
% OUT:
%   - Sx: the sigmoid function evaluated at x
%   - dsdx: the derivative of the sigmoid function wrt x
%   - dsdp: the derivative of the sigmoid function wrt Phi.

% get default parameterization
if ~exist('in','var')
    in = [];
end