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: model_3d.m
    path of file: ./repos/Isogeometric-Analysis/models/strain_gradient_plasticity
    
    the code of the file until where you have to start completion: %--------------------------------------------------------------------------
%  Author: Isaac J. Lee (ijlee2@ices.utexas.edu)
%  
%  
%  Summary:
%  
%  This routine solves the problem of 3D strain gradient plasticity for
%  isotropic and homogeneous materials.
%  
%  
%  Instructions:
%  
%  Use the terminal to run the driver file with this command:
%  
%      ./matbg.sh driver_3d.m output
%  
%  Note t
    
function
                                hardening_function = material_sigmaY + isotropicHardeningFactor * material_H * strain_pl_eq_old(q);
                                
                                % Evaluate the yield function
                                yield_function = stress_dev_norm - constant_sq2d3 * hardening_function;
                                
                                
                                %------------------------------------------
                                %  Elastic state
                                %------------------------------------------
                                if (yield_function <= 0)
                                    %--------------------------------------
                                    %  Accept the trial state
                                    %--------------------------------------
                                    % Do not update the backstress tensor
                                    if (isotropicHardeningFactor < 1)
                                        backstress(:, q) = backstress_old(:, q);
                                    end