Effacer les filtres
Effacer les filtres

PID controller, difference when graphing step function with PID control block in matlab and simulink

55 vues (au cours des 30 derniers jours)
Hi everyone,
please tell me, why is there a difference when graphing step function with PID control block in matlab and simulink
s =tf('s');
g = 1.883e5/(s*(s^2+4466*s+6.43e6));
kp = 60;
ki = 63000;
kd = 3;
gpid = pid(kp,ki,kd);
gsys = feedback(g*gpid,1);
step(gsys)

Réponse acceptée

Sam Chak
Sam Chak le 2 Juil 2024 à 4:16
Both responses look similar if you implement them correctly as shown.
s = tf('s');
Gp = 1.883e5/(s^2 + 4466*s + 6.43e6);
kp = 60;
ki = 63000;
kd = 3;
Gc = pid(kp, ki, kd);
Gcl = feedback(Gc*Gp, 1);
step(Gcl), grid on, ylim([-0.1, 1.1])
  6 commentaires
hoang
hoang le 3 Juil 2024 à 2:13
Thanks for the repply @Sam Chak. It really helped.
Sam Chak
Sam Chak le 3 Juil 2024 à 6:03
I'm glad to hear that. If you find the explanation and code helpful, please consider clicking 'Accept' ✔️ on my Answer. Additionally, you can show your appreciation by voting 👍 for other answers by Paul and Umar as a token of support for their knowledge sharing. Your support is greatly appreciated!

Connectez-vous pour commenter.

Plus de réponses (2)

Paul
Paul le 2 Juil 2024 à 3:28
Hi hoang,
The posted code doesn't result in the same figure as in the question
s =tf('s');
g = 1.883e5/(s*(s^2+4466*s+6.43e6))
g = 188300 -------------------------- s^3 + 4466 s^2 + 6.43e06 s Continuous-time transfer function.
kp = 60;
ki = 63000;
kd = 3;
gpid = pid(kp,ki,kd);
gsys = feedback(g*gpid,1);
step(gsys)
Note also that g in the Matlab code has an integrator in the denominator that is not present in the plant model in the Simulink diagram.
What is inside the subsystem block in the Simulink diaggram?
  2 commentaires
hoang
hoang le 2 Juil 2024 à 6:56
I'm sorry I copied it wrong
g = 1.883e5/(s^2+4466*s+6.43e6);
My inside the subsystem block

Connectez-vous pour commenter.


Umar
Umar le 2 Juil 2024 à 3:00
Hi Hoang,
My suggestion would be tuning the PID controller gains appropriately. You can use tools like the PID Tuner in Simulink or MATLAB's Control System Toolbox to adjust the controller parameters for better system performance. Try using the pidtune function to tune the PID controller. For more information regarding this function, please refer to
https://www.mathworks.com/help/control/ref/dynamicsystem.pidtune.html
Let me know if you need further assistance.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by