    function K = ctrl(tuning)
        s = tf('s');
        Kc = tuning(1);
        I = tuning(2);
        
        switch 'PIDF'
            case 'PID'
                D = tuning(3);
                K = Kc*(1-I-D+I/s+D*s);
            case 'PIDc'
                D = tuning(3);
                K = Kc*(I*s+1)*(D*s+1)/I/s;
            case 'PI'
                if length(tuning) > 2
                    error('sending D to the PI controller!!!!')
                end
                K = Kc*(I*s+1)/I/s;
            case 'PIDF'
                D = tuning(3);
                F = tuning(4);
                K = Kc*(1 + I/s + D*s/(F*s+1));
                
            case 'PIDF_3dof'
                D = tuning(3);
%                 F = problem.controller{2};
                F=4;
                K = Kc*(1 + I/s + D*s/(F*s+1));
                
            case 'smith'
                K = pidstd(Kc,I);
                K = K/(1+K*Gnd*(1-exp(-s)));
                
        end
    end