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: saturateInputDerivative.m
    path of file: ./repos/whole-body-controllers/library/matlab-wbc/+wbc
    
    the code of the file until where you have to start completion: function uSat = saturateInputDerivative(u, u_0, tStep, uDeltaMax)

    % SATURATEINPUTDERIVATIVE saturates the input u such that the absolute 
    %                         value of its numerical derivative:
    %                        
    %                             uDelta = (uPrev-u)/tStep
    %                         
    %                         cannot be greater than a predefined value. 
    %
    % FORMAT: uSat 
    
function y = saturateInput(u, min, max)

    assert(isequal(size(min), size(max)), 'Min and max must be same size')

    if length(min) == 1
    
        y          = u;
        y(y > max) = max;
        y(y < min) = min;
    else
    
        assert(length(min) == length(u), 'input and saturation must have same size');
        y = u;
    
        for i = 1:length(min)
        
            if y(i) > max(i)
                
                y(i) = max(i);
                
            elseif y(i) < min(i)
            
                y(i) = min(i);
            end