![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1227997/image.png)
unit step disturbance at a time of 40 seconds
12 次查看(过去 30 天)
显示 更早的评论
How do I generate a unit step disturbance at a time of 40 seconds for my PID controller
clear all;
s=tf('s');
load time.dat;
load response.dat;
K = 2;
Tau = 3;
dt = 0.9;
g = ((2/(3*s + 1))*(exp(-dt*s)))
[gy,tg]=step(g,20)
plot(time, response,'k',tg,gy,'r','LineWidth',2)
hold on
% Cohen - Coon PI tuning
Kc = (1/K)*(Tau/dt)*(0.9 + (dt/(12*Tau)));
Tau_1 = (dt)*((30 + 3*(dt/Tau))/(9+20*(dt/Tau)));
P = Kc;
I = Kc/Tau_1;
cont = ((s*P + I)/s);
gol = cont*g
gcl = feedback(gol,1)
step(gcl,20)
hold on
grid on
Thanks
0 个评论
回答(1 个)
Sam Chak
2022-12-12
编辑:Sam Chak
2022-12-12
The closed-loop transfer function for Y(s)/D(s) is given by
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1227997/image.png)
The following shows how to compute the comparison between the step responses for 40 seconds. Let us know if this is the technical answer that you are looking for.
s = tf('s');
% Parameters
K = 2;
Tau = 3;
dt = 0.9;
% Plant
Gp = ((2/(3*s + 1))*(exp(-dt*s)));
% Cohen - Coon PI tuning
Kc = (1/K)*(Tau/dt)*(0.9 + (dt/(12*Tau)));
Tau_1 = (dt)*((30 + 3*(dt/Tau))/(9 + 20*(dt/Tau)));
Kp = Kc;
Ki = Kc/Tau_1;
Gc = ((Kp*s + Ki)/s);
% Response to the Unit Step Reference
Gol = Gc*Gp;
Gcl = feedback(Gol, 1); % closed-loop transfer function Y(s)/R(s)
step(Gcl, 40)
hold on
% Response to the Unit Step Disturbance
Gcd = feedback(Gp, Gc); % closed-loop transfer function Y(s)/D(s)
step(Gcd, 40)
legend('Step Reference Response', 'Step Disturbance Response')
hold off, grid on
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Classical Control Design 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!