📄 motor_5_1.m
字号:
%PID arithmetic
s=tf('s');
G=0.01/(0.005*s^2+0.06*s+0.1001); %Model unchanged
t=[0:0.01:3];
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');
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('Standard PID','Improved PID',2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -