what is the code to implement a disturbance of 0.2 in the system at 400 sec that would test the disturbance rejection of the controller and allow the system to return to 1?
13 views (last 30 days)
Show older comments
Hi All,
Can anyone help me with MATLAB code for a disturbace of 0.2 at 400 seconds that would test the disturbance rejection of the PID controller and allow the system to return to 1?
I need to test the tuning by applying a disturbance at 400 seconds to see how the controller responds in that case in MATLAB code.
Help very much appreiciated!!
Thanking you
0 Comments
Answers (1)
Sam Chak
on 28 Feb 2023
Since your system is not provided, here is a simple example to demonstrate the disturbance rejection capability of a PID controller for a Double Integrator system.
s = tf('s');
m = 5;
Gp = 1/(m*s^2) % Plant
% PID controller
Kp = 2.460; % proportional gain
Ki = 0.324; % integral gain
Kd = 4.650; % derivative gain
N = 114.29; % 1st-order derivative filter coefficient
Gc = pid(Kp, Ki, Kd, 1/N)
margin(Gc*Gp)
% closed-loop transfer function from Disturbance R(s) to Output Y(s)
Gcd = feedback(Gp, Gc)
step(Gcd), grid on % Response to a Unit step disturbance
If the output response to a unit step disturbance D(s) = 1 goes to zero in 50 seconds, then rest assured that the output will track the unit step reference R(s) = 1.
% closed-loop transfer function from Reference R(s) to Output Y(s)
Gcl = feedback(Gc*Gp, 1)
step(Gcl, 60), grid on % Step Response
0 Comments
See Also
Categories
Find more on Schedule Model Components in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!