![](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!