# Problem with Discrete Controller Design

6 views (last 30 days)
Martin Werner on 10 Oct 2019
Answered: Martin Werner on 10 Oct 2019
I am having an issue with designing a lead-lag controller. The bode plot of the continous controller is looking as expected but the discrete version of it is completely different and exhibits some weird spikes in the lower frequency section.
Margin of continous controller.
Bode plot of continous (blue) and discrete controller (orange).
The Sampling period is 81 ns which i use in the c2d function (with ZOH).
Is this some kind of numerical error or am I missing and/or misunderstanding something really important here?
Best regards,
Martin

M on 10 Oct 2019
It could actually be both.
It is indeed possible that the discretization with a given frequency brings problems such as oversampling, that you do not encounter with the continuous time model. It is difficult to say without further investigation.

Martin Werner on 10 Oct 2019
Thanks for the answer. I am really new to matlab so it might be just me.
I am designing a model of a PLL. The Controller consists of a lead-lag and an integrator with a gain. The plant consists of just an integrator. Hence the resulting transfer functions are:
7.548634701167306 z - 7.545828925881343
---------------------------------------
z - 9.971942247140364e-01
Lag:
3.162277660168379e-01 z - 3.162277659911033e-01
-----------------------------------------------
z - 9.999999999742654e-01
Integrator:
6.622738308376736e-07 <--- scaled gain
----------------------
z - 1
Accu:
9.999999999999999e-01
---------------------
z - 1
All of them together results in:
7.898111270872263e-07 z^2 - 3.475364823982782e-10 z - 7.888759788430395e-07
---------------------------------------------------------------------------------
z^3 - 2.997194224769681e+00 z^2 + 2.994388449539206e+00 z - 9.971942247695248e-01
I also tried a "simpler" model using ZPK with poles and zeros at integer positions but the result is the same as soon as the integrator is added. The bode plots of the sub functions by themselves all seem fine. As soon as u multiply them, things become weird. I suppose because of the increased order of the resulting function. But it should be possible to design a regular second order controller with an integrator, shouldn't it?