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: CBIG_olda_update_alpha.m
    path of file: ./repos/CBIG/utilities/matlab/HBM/onlinelda
    
    the code of the file until where you have to start completion: function [params, log_alpha_change] = CBIG_olda_update_alpha(params)

% Update alpha hyperparameter
% FORMAT [params, log_alpha_change] = CBIG_olda_update_eta(params)

    
function [params, log_alpha_change] = CBIG_olda_update_alpha(params)

% Update alpha hyperparameter
% FORMAT [params, log_alpha_change] = CBIG_olda_update_eta(params)
%
% Written by B.T.Thomas Yeo and CBIG under MIT licence: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md

old_log_alpha = params.log_alpha;
if(params.kappa == 0) % normal LDA
    
    init_alpha = params.init_alpha;
    for i = 1:params.max_m_iter
        
        % Compute gradient, hessian and update
        [log_alpha_gradient, alpha_gradient] = compute_log_alpha_gradient(params);
        log_alpha_hessian  = compute_log_alpha_hessian(params, alpha_gradient);
        log_alpha = params.log_alpha - log_alpha_gradient/log_alpha_hessian;
        
        % update alpha
        log_alpha_change = max(abs(log_alpha - params.log_alpha));
        params.log_alpha = log_alpha;
        
        % check exit condition and out of range
        if(isinf(exp(params.log_alpha)) || isnan(exp(params.log_alpha)))
            params.log_alpha = log(init_alpha);
            init_alpha = init_alpha*10;
            disp(['WARNING: (M-step opt) Alpha out of range! Reinitialize log(alpha) to ' num2str(params.log_alpha)]);
        else
            if(log_alpha_change < params.m_converge)
                break; 
            else
                disp(['Iter ' num2str(i, '%04d') ': Alpha change: ' num2str(log_alpha_change)]);
            end