Tuning PI, PD, PID controller
Show older comments
Hi guys,
I'm using pidtune and pidtool for tuning the controllers, but even if I put all three constants (Kd, Ki, Kp) it tunes the controller as if it's a p controller. Will post the code bellow, also the return message as a pic. Please help <3
.
. Kp=290;
Ki=500;
Kd=46;
num1=[Kd Kp Ki];
den1=[1 0];
W=tf(num1,den1);
num2=[1];
den2=[1 10 20];
G=tf(num2,den2);
A=series(W,G);
sys=feedback(A,1);
t=0:0.01:2;
y=step(sys,t);
plot(t,y);
grid on;
pidtune(G,'pi')
pidtool(G,'pid');
Answers (1)
Not sure what happened. But it works for both auto and manual tuning.
% Plant
Gp = tf(1, [1 10 20])
% PID (Auto)
Gc1 = pidtune(Gp, 'PID')
Gcl1 = feedback(Gc1*Gp, 1);
% PIDF (Manual)
kp = 32.94;
ki = 86.88;
kd = 0.3632;
Tf = 0.1208;
Gc = pid(kp, ki, kd, Tf)
Gcl2= feedback(Gc*Gp, 1);
% Step responses
step(Gcl1, 2), hold on
step(Gcl2, 2), grid on
legend('PID', 'PIDF')
Categories
Find more on PID Controller Tuning in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!