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: conAffPoint2PlaneSimpleOLS.m
    path of file: ./repos/Point_cloud_tools_for_Matlab/costfunctions
    
    the code of the file until where you have to start completion: function [bFun, b0Fun, derFun] = conAffPoint2PlaneSimpleOLS(prm, cst, obs)

% ------------------------------------------------------------------------------

bFun = @(obs) bFunNested(obs);

    function bBlock = bFunNested(obs)
       
        bBlock = obs.dp;
        
    end

% -
    
function derFunBlock = derFunNested(prm, cst, var)
        
        switch var
            
            % ------------------------------------------------------------------
            
            case 'prm_a111'
                
                derFunBlock =   cst.x1 .* cst.nx1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a121'
                
                derFunBlock =   cst.y1 .* cst.nx1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a131'
                
                derFunBlock =   cst.z1 .* cst.nx1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a211'
                
                derFunBlock =   cst.x1 .* cst.ny1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a221'
                
                derFunBlock =   cst.y1 .* cst.ny1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a231'
                
                derFunBlock =   cst.z1 .* cst.ny1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a311'
                
                derFunBlock =   cst.x1 .* cst.nz1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a321'
                
                derFunBlock =   cst.y1 .* cst.nz1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a331'
                
                derFunBlock =   cst.z1.* cst.nz1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a112'
                
                derFunBlock = - cst.x2 .* cst.nx1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a122'
                
                derFunBlock = - cst.y2 .* cst.nx1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a132'
                
                derFunBlock = - cst.z2 .* cst.nx1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a212'
                
                derFunBlock = - cst.x2 .* cst.ny1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a222'
                
                derFunBlock = - cst.y2 .* cst.ny1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a232'
                
                derFunBlock = - cst.z2 .* cst.ny1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a312'
                
                derFunBlock = - cst.x2 .* cst.nz1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a322'
                
                derFunBlock = - cst.y2 .* cst.nz1;
            
            % ------------------------------------------------------------------
            
            case 'prm_a332'
                
                derFunBlock = - cst.z2.* cst.nz1;
            
            % ------------------------------------------------------------------
            
            case 'prm_tx1'

                derFunBlock =   cst.nx1;
        
            % ------------------------------------------------------------------
            
            case 'prm_tx2'

                derFunBlock = - cst.nx1;
                
            % ------------------------------------------------------------------
            
            case 'prm_ty1'

                derFunBlock =   cst.ny1;
                
            % ------------------------------------------------------------------
            
            case 'prm_ty2'

                derFunBlock = - cst.ny1;
                
            % ------------------------------------------------------------------
            
            case 'prm_tz1'

                derFunBlock =   cst.nz1;
                
            % ------------------------------------------------------------------
            
            case 'prm_tz2'

                derFunBlock = - cst.nz1;
                                        
        end