This is more or less lifted from the Matlab manual; I've only got passing experience...
function my_output = wave ( a, b, n, k, T, f, flag, varargin )
optargin = numel(varargin);
fTrue = inline('0');
if optargin > 0
fTrue = varargin{1};
end
% code ...
end