Hi @Paolo
Your question on the control problem went unnoticed for more than 1 month. The plant system has a zero (s = 0.1) in the right-half plane. Therefore, it is not easy to design a satisfactory ideal PID controller. You may have noticed that as the derivative gain
approaches 1, the undershoot of the closed-loop system also grows infinitely large in the negative direction.
The example below illustrates four cases, with the first being the uncompensated system (stable but with unacceptably large undershoot), and the other three involving 'ideal' PID controllers. If a smaller undershoot is desired, you will need to explore other configurations of controllers.
%% Non-minimum Phase Plant
s = tf('s');
Gp = tf((- s + 0.1)/((s + 0.6)*(s + 8)))
%% OP's manually-tuned PID Controller (Ziegler–Nichols)
Gc1 = pid(5.16, 3.85, 0.6172) % with kd < 1 is selected
Gcl1= minreal(feedback(Gc1*Gp, 1))
%% Auto-tuned PID Controller (Unspecified requirements)
Gc2 = pidtune(Gp, 'PID')
Gcl2= minreal(feedback(Gc2*Gp, 1));
%% Optimized 'ideal' PID Controller
kp = 0.0290818775069017; % P-gain
ki = 2.45979506934827; % I-gain
kd = 0.216673683005054; % D-gain
Gc3 = pid(kp, ki, kd)
Gcl3= minreal(feedback(Gc3*Gp, 1));
%% Plot Step response and data collection
Gcl = [Gp/dcgain(Gp), Gcl1, Gcl2, Gcl3];
for j = 1:4
sNFO(j) = stepinfo(Gcl(j)); % stored in sNFO structure
step(Gcl(j), 60) % simulate up to 60 sec
hold on
end
hold off
grid on
legend('Case 1: Uncompensated', 'Case 2: Z–N tuned PID', 'Case 3: Auto-tuned PI', 'Case 4: Optimized PID', 'location', 'E')
%% Table of Step-response Characteristics
myCell = [fieldnames(sNFO), permute(struct2cell(sNFO), [1 3 2])];
myTable = cell2table(myCell, "VariableNames", ["Performance Aspect", "Case 1", "Case 2", "Case 3", "Case 4"])

