What is the correct syntax for TransferFunctionModel?

One of the forms for TransferFunctionModel is:

TransferFunctionModel[{z, p, g}, s]

Where z, p, g are the zeroes, poles, and gain.

There is no detail or example on this syntax that I can find. So I assume z and p are each lists of the numerical values, and g is a single constant. I try this in the code below, which describes a zero at -5000, and poles at -100 and -1000. This works fine if I just use the s domain expression, but returns unevaluated for my assumed {z,p,g} syntax.

tfm1 = TransferFunctionModel[{{20 (s + 5000)/((s + 100) (s + 1000))}},
   s]

BodePlot[tfm1, {1, 100000}] (* this plots correctly *)

(* this is the {zeros, poles, gain} where zroes and poles is each a \
list of the values *)
(*it returns unevaluated *)
tfm2 = TransferFunctionModel[{{-5000}, {-100, -1000}, 1}, s]

Does anyone know how to do this correctly? Or where more documentation can be found?

Best, David

tf1 = TransferFunctionModel[(5 (1 + s))/(10 + s), s]
tf2 = TransferFunctionModel[{{{5 (1 + s)}}, {{10 + s}}}, s]
tf3 = TransferFunctionModel[{{{{-1}}}, {{{-10}}}, {{5}}}, s]

Plot[
 Evaluate[
  OutputResponse[#, UnitStep[t - 1], {t, 0, 10}] & /@ {tf1, tf2, tf3}], 
  {t, 0, 10}, PlotRange -> All]

See tf3 for the correct syntax. (tf2 is with numerator and denominator)

Thanks, Fabian. I was not using lists there were sufficiently deep in nesting.

Best,
David

This exact issue came up for me today; I even tried a variety of list nesting levels, and couldn’t get it to work. Thanks! --Todd

Instead of dealing with all those {{{...}}}, I like to just use the standard gain * num(s)/den(s) for everything. Like this:

gain = 5;
zeros = {-1, -2};
poles = {0, -4, -6};
num = Times @@ ((s - #) & /@ zeros);
den = Times @@ ((s - #) & /@ poles);

Now use standard gain * G(s) synatx

 tf = TransferFunctionModel[gain (num/den), s]

The above is simpler for me than writing

 tf = TransferFunctionModel[{{{{-1, -2}}}, {{{0, -4, -6}}}, {{gain}}}, s]

And having to count braces to make sure they match.

If you look under the documentation under the “Scope” drop down, there is an example that shows the correct syntax for the {z, p, g} syntax. The documentation under “Details and Options” should probably include this (as it does for {num, den} syntax).