how to get PID output?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
hello i am currently doin my bachelor thesis ,, the project is ball on beam. i am using PID function for matlab to control a servo motor . the code is as follows:
s = tf('s');
P_ball = 0.48/s^2;
Kp =2;
Kd =1;
Ki=.75;
C = pid(Kp,Ki,Kd);
sys_cl=feedback(P_ball,1);
t=0:0.01:5;
step(0.25*sys_cl)
disp(sys_cl);
The problem is extracting the output value from the PID function. the output of PID function is supposed to be the angle of the servo motor,, now i dont know how to get this angle in order to give it to the servo motor continuously. can anyone help?
0 Kommentare
Antworten (4)
Arkadiy Turevskiy
am 7 Jul. 2014
Your code, as written does not make much sense. You define controller C, but then do not use it, and instead just use unity gain when computing closed-loop response. I am also not sure why you are mutiplying sys_cl by 0.25 when computing the step reponse.
The more meaningful code would be:
s = tf('s');
P_ball = 0.48/s^2;
Kp =2;
Kd =1;
Ki=.75;
C = pid(Kp,Ki,Kd);
sys_cl=feedback(C*P_ball,1);
t=0:0.01:5;
step(sys_cl)
what you see then is the angle of the motor (the variable you control). The output of the PID would be something like a voltage request to the motor. Another issue is that typically a motor transfer function is not a double integrator, like your plant transfer function, but that's for you to figure out.
2 Kommentare
parag patil
am 23 Okt. 2020
Hello,
I had the same question. Sorry for being too late, but did you manage to get the answer?
Komal Damodara
am 4 Apr. 2019
s = tf('s');
P_ball = 0.48/s^2;
Kp =2;
Kd =1;
Ki=.75;
C = pid(Kp,Ki,Kd);
sys_cl=feedback(C*P_ball,1);
t=0:0.01:5;
step(sys_cl)
0 Kommentare
Komal Damodara
am 4 Apr. 2019
s = tf('s');
P_ball = 0.48/s^2;
Kp =2;
Kd =1;
Ki=.75;
C = pid(Kp,Ki,Kd);
sys_cl=feedback(C*P_ball,1);
t=0:0.01:5;
step(sys_cl)
0 Kommentare
Siehe auch
Kategorien
Mehr zu PID Controller Tuning finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!