Why does PID controller block output non-zero values even when the P, I, and D gains are set to 0, when using MATLAB R2023b?
19 views (last 30 days)
Show older comments
MathWorks Support Team
on 3 Jul 2025
Commented: Suyash
on 7 Oct 2025 at 15:14
I am trying to use a PID controller block. The P, I, and D gains are all set to 0, and the input to the block is finite (between -60 and 10 for the first ~60 seconds). The PID controller is set to discrete time with sample time of 10 seconds and the output of the controller is saturated between 5000 and 10000. The integrator and filter are initialized to 4000 each. Despite the gains being 0, the output is still non-zero and keeps on oscillating between 5000 and 10000. Why is the output non-zero despite zero gains?
Accepted Answer
MathWorks Support Team
on 3 Jul 2025
When using the PID Controller block with all P, I, and D gains set to zero, the output can still be non-zero if the integrator and filter initial conditions are non-zero. This is because:
- With zero I gain, the integrator initial condition acts as a constant offset in the output.
- With zero D gain, the filter initial condition can cause the output to oscillate.
To ensure the output is zero when all gains are zero, set the integrator and filter initial conditions to zero.
For more information, see the block documentation for
.
5 Comments
Paul
on 19 Jul 2025
Hey Sam,
Some gains scheduled to zero at certain operating conditions? Maybe. I'd be curious to see an example of that. Maybe there's a case where the plant is transitioning from unstable to stable that causes one or two gains to change sign?
But all three gains scheduled to zero, as discussed in this thread, at any operating condition sounds problematic.
Suyash
on 7 Oct 2025 at 15:14
Hi everyone, thank you for your comments and contributions to this post. As pointed out by Sam in the first comment, the integrator gain is applied on the input before the integration, for both externally supplied and internally supplied gains. Therefore, the initial condition is not subject to the integrator gain and therefore, the integration can result in a non-zero value even when the integrator gain is zero. Similarly, even when D gain is zero, the output can still be non-zero when the filter initial condition is a non-zero value.
The equation in the documentation here shows this, however, we will consider improving this to show how initial condition is incorporated.
Hope this helps! Let me know if you have any more questions.
More Answers (0)
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!