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: peak_det_likelihood.m
    path of file: ./repos/OSET/matlab/tools/ecg
    
    the code of the file until where you have to start completion: function [peaks, peak_indexes, peak_indexes_consensus, qrs_likelihood] = p
    
function for the R-peaks (useful for classification and scoring purposes)
if ~isfield(params, 'likelihood_sigma') || isempty(params.likelihood_sigma)
    params.likelihood_sigma = 0.01;
    if params.verbose, disp(['params.likelihood_sigma = ', num2str(params.likelihood_sigma)]), end
end
if ~isfield(params, 'max_likelihood_span') || isempty(params.max_likelihood_span)
    params.max_likelihood_span = 0.1;
    if params.verbose, disp(['params.max_likelihood_span = ', num2str(params.max_likelihood_span)]), end
end
qrs_likelihoods = zeros(num_peak_refinement_algorithms, sig_len);
for kk = 1 : num_peak_refinement_algorithms
    qrs_likelihoods(kk, :) = peak_surrounding_likelihood(sig_len, find(peaks_all_method(kk, :)), fs, 'GAUSSIAN', params.max_likelihood_span, params.likelihood_sigma);
end