![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1227997/image.png)
unit step disturbance at a time of 40 seconds
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Sam Chak
el 12 de Dic. de 2022
Editada: Sam Chak
el 12 de Dic. de 2022
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 comentarios
Ver también
Categorías
Más información sobre PID Controller Tuning en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!