How to write a system to PID

3 次查看(过去 30 天)
Kevin Tran
Kevin Tran 2020-5-17
Hi guys,
I'm currently in a course in control engineering and still pretty new on the whole subject. I got this system: y''+25y'+25y=u
The problem is I want to make a PID where I can change the parameters Kp, TI and TD. I know how to write the system into matlab with ode45:
[T2,Y2]=ode45(@diffeq2,[0 10],[0;0]);
plot(T2,Y2)
function dy = diffeq2(t,y)
if t < 0
u = 0;
else
u = 1;
end
dy = zeros(2,1);
dy(1) = y(2);
dy(2) = u - 10*y(2) - 25*y(1);
end
but I have no idea how to change the script so I can change the parameters Kp, TI and TD for example to Kp=1 TI=0.1 and TD=0.2 to get a better step response like my professor did. He didn't show how to do it just that with those parameters you will get a better step response and then he showed the graph but no script on how to do it. I have searched everywhere and watched several videos for hours without understanding anything. So my last resort is asking the matlab community for help.
Thanks in advance if you can help me!

回答(1 个)

Nikhil Sonavane
Nikhil Sonavane 2020-5-20
I would suggest you go through the Design and implement PID controllers which has several videos and documents which may help you solve your query.

类别

Help CenterFile Exchange 中查找有关 PID Controller Tuning 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by