Setting a Specific Formula for PID Controller in Simulink (Matlab)
12 views (last 30 days)
Show older comments
I need to add a PID Controller to a Simulink Project with formula 1/(s+4.54) but I couldn't find the proper constants for the formula.
I tried looking at the different types of PID crack Controller libraries. I also tried finding the constants by solving the equation but couldn't.
0 Comments
Answers (2)
Sam Chak
on 9 Nov 2023
Hi @nora
Use the Transfer Funtion block instead.
4 Comments
dorrin
on 9 Nov 2023
I posted the question on Stackoverflow and saw it here today (Maybe it's automatically reposted?).
Is it possible to use the PID Tuning feature to get the function
? This is the project I have to build:

Sam Chak
on 15 Nov 2023
The step response looks okay, no overshoot and settles within 6 seconds. Are the performance requirements satisfied?
% Plant
Gp = tf(30, [1 30 0])
% Compensator
Gc = tf(4, [1 4.54])
% Pre-filter
Gf = tf(1, [1 1])
% Closed-loop system
Gcl = feedback(Gc*Gp, 1)
% Closed-loop system with Prefilter
Gclf = Gf*Gcl
% Plot Step response
step(Gclf, 10), grid on
stepinfo(Gclf)
Sam Chak
on 15 Nov 2023
If you intend to use a PID controller to make the system behave similarly to the designed compensator, you'll need to make some slight modifications to the control loop configuration. The system under the PID controller should have the same settling time.
% Plant
Gp = tf(30, [1 30 0])
Gpp = feedback(Gp, 1);
% PID Controller
kp = 0.266920333340203;
ki = 0.516920333340203;
kd = -0.111860942402338;
Tf = 0.483633519278621;
Gc = pid(kp, ki, kd, Tf)
% Closed-loop system
Gcl = feedback(Gc*Gpp, 1)
% Plot Step response
step(Gcl, 10), grid on
stepinfo(Gcl)
0 Comments
See Also
Categories
Find more on PID Controller Tuning in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

