function [ K ] = pid_lee( Ge,lambda )


num = Ge.num{1};
den = Ge.den{1};

b1 = num(2);
b0 = num(3);

a1 = -den(2);
a0 = den(3);

s = tf('s');
G1 = b1/(s-a1);
tau_red = 1/a1;
K_red = b1/a1;

theta=0.1;

%UNTITLED2 Summary of this function goes here
%   Detailed explanation goes here

alpha_red=tau_red*((((lambda/tau_red)+1)^2)*exp((theta/tau_red))-1);

%Now,the PID tuning
taui_red=(-tau_red)+(alpha_red)-(((lambda^2)+(alpha_red*theta)-((theta^2)/2))/((2*lambda)+theta-alpha_red));
Kc_red=taui_red/(-K_red*((2*lambda)+theta-alpha_red));
taud_red=(((-tau_red*alpha_red)-((((theta^3)/6)-((alpha_red*(theta^2)/2)))/((2*lambda)+theta-alpha_red)))/taui_red)...
    -(((lambda^2)+(alpha_red*theta)-((theta^2)/2))/((2*lambda)+theta-alpha_red));

%Assembling the controller
% g=G_full;%((-0.005331*s - 4.763e-05)*exp(-5*s))/(s^2 - 0.001234*s + 2.153e-05); %defining transfer function
% g_red=G_reduced;
P_red=Kc_red;
I_red=1/taui_red;
D_red=taud_red

K=minreal(P_red*(1+(I_red/s)+(D_red*s/(4*s+1)))); % defining the PID
filter_red=1/((alpha_red*s)+1); %defining the filter

end

