📄 motor_5_3.m
字号:
%PID arithmetic
s=tf('s');
G=0.1/(0.1*s^2+1.2*s+1); %Model changed
t=[0:0.01:30];
Kc=100; %Standard PID
Ti=0.5;
Td=0.1;
Gc=Kc*(1+1/(Ti*s))*(Td*s+1);
sys=G*Gc/(1+G*Gc);
y=step(sys,t);
plot(t,y);
hold on;
xlabel('t');
ylabel('y');
title('PID controller After the model changes a little');
Ts=0.01; %Improved PID
Ki=Kc*Ts/Ti;
Kd=Kc*Td/Ts;
Gc1=Kc*(1+1/(Ti*s));
Gc2=(Td*s+1)/(Td/Kd+1);
sys=G*Gc1/(1+G*Gc1*Gc2);
y=step(sys,t);
plot(t,y,'r');
Legend('StandardPID','ImprovedPID',2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -