# DC gain of a transfer function

Consider this example.

M = TransferFunctionModel[3/(s^2 - s + 5), s]


the DC gain should be the value of the transfer function M[s] for s = 0, that is M[0] = 3/5.

But if I input the command (which was suggested in this answer: "How to convert a transfer function model to a zero-pole-gain model?")

ControlZeroPoleGainModel[M]


this is the output from Mathematica:

ControlZeroPoleGainModel[{{{{}}}, {1/2 (1 - i Sqrt[19]), 1/2 (1 + i Sqrt[19])}, {{3}}}, s]


Note that the gain given by Mathematica is 3, whereas I was expecting 3/5.

What am I doing wrong here?

• I'm having not a clue about TransferFunctionModel but did you see that the vector before {{3}} gives 5 if you multiply the complex numbers which are complements of each other? Maybe this is the scaling. Commented Feb 27, 2017 at 4:45

The k in zpk is not the same as the dc gain. Given transfer function $\frac{num(s)}{den(s)}$, we write the tf in the form $k\frac{(s-z_1)(s-z_2)\dots}{(s-p₁)(s-p₂)\dots}$ where $z_{i}$ are the zeros of the numerator polynomial and $p_{i}$ are the zeros of the denominator polynomial.

The number which remains in the front, is the $k$. Sometimes called system gain, not to confuse it with dc gain.

In your example, the tf in zpk is simply $3 \frac{1}{(s-p_1)(s-p_2)}$ Since numerator polynomial is 1. There are only 2 poles. Hence $k=3$.

The dcgain, is step output at $t=\infty$. This is found as follows, using final value theorem

ClearAll[s, w];
tf = 3/(s^2 - s + 5);
stepOutput = tf * LaplaceTransform[UnitStep[t], t, s];
Limit[s stepOutput, s -> 0]


btw, matlab has separate function called dcgain, as well as the zpk as Mathematica. Here is result from Matlab which agrees with Mathematica's

>> clear all
>> s=tf('s');
>> sys=3/(s^2-s+5);
>> dcgain(sys)

0.6000

>> [z,p,k] = zpkdata(sys);
>> k

3


You can see that dcgain is not the same as the $k$ in zpk.

• Hi Nasser, I got your point. When in "zpk" mode, the gain of the system is $k$ which is not the DC gain, but it is just the $k$ factor multiplying $G(s)=k\frac{(s-z_{1})(s-z_{2})}{(s-p_{1})(s-p_{2})}$. The DC gain is found if $s=0$ and it is $G(0)=k\frac{z_{1}z_{2}}{p_{1}p_{2}}$. Thank you very much Commented Mar 2, 2017 at 0:15
• note that $s = 0$ is the same as $t=\infty$ (final value theorem) Commented Apr 2, 2020 at 20:32

You can use ControlStaticGains

tf = 3/(s^2 - s + 5);
ControlStaticGains[TransferFunctionModel[tf, s]]


{{3/5}}

Or use the final value theorem

Limit[tf, s -> 0]


3/5

Nasser's answer already explains why StaticGains (or dc gain) is not the same as the gains in ControlZeroPoleGainModel. The former is a system property, the latter is just an algebraic construct.

• Is ControlStaticGains documented?
– user36273
Commented Feb 27, 2017 at 15:05
• It's undocumented right now. That's why it's in the Control context. Commented Feb 27, 2017 at 15:27

Another way to determine the dc gain:

tf = TransferFunctionModel[3/(s^2 - s + 5), s];
{a, b, c, d} = Normal@StateSpaceModel[tf];
dcgain = -c.Inverse[a].b + d
`

{{3/5}}