paul
paul

Reputation: 402

MATLAB PID Filter Coefficient

I have a problem in producing the algorithm of a PID with Filter Coefficient. The block diagram of the PID with Filter Coefficient looks like this. enter image description here

I found an algorithm/code in this link. https://www.mathworks.com/matlabcentral/answers/63762-filter-coefficient-n-in-pid-block

enter image description here

Question: Why is that the FilterCoefficient has an unknown variable Filter_DSTATE which has an unknown variable of FilterCoefficient? The code of FilterCoefficient has an unknown variable of Filter_DSTATE and the code of Filter_DSTATE has an unknown variable of FilterCoefficient?

Hypothesis. Is it one of them supposed to be initialize by some value?

Upvotes: 1

Views: 7709

Answers (1)

percusse
percusse

Reputation: 3106

If you open a blank simulink model and add PID controller you will get a dialog after double-click

enter image description here

The derivative term of the PID controller is never implemented as a pure derivative because that would be extremely sensitive to noise. Hence, a cutoff frequency is added.

So, the D term will act like almost a derivative up to a frequency via

          Ns
s ---> --------
        s + N

N being the filter coefficient you mention. This also makes it possible to implement a D term using an integrator avoiding a noisy derivative operation.

enter image description here

Upvotes: 5

Related Questions