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: smoothbestSpan.m
    path of file: ./repos/acycle/code/seriesanalysis
    
    the code of the file until where you have to start completion: % bestSpan
function bestSpan = smoothbestSpan(t,y,method,alpha,beta)

% input
%   t: time
%   y: value
%   method: smooth method
%   alpha: Penalty 
    
function bestSpan = smoothbestSpan(t,y,method,alpha,beta)

% input
%   t: time
%   y: value
%   method: smooth method
%   alpha: Penalty parameters
%   beta: Penalty parameters
% output
%   bestSpan
%
% Mingsong Li, aided by GPT-4
%
% Penalty parameters (chosen experimentally, you might want to fine-tune them)
if nargin < 4; alpha = 0.01; beta = 0.01; end