What is the correct way to extract coefficients (in a form I could use in RecurrenceFilter) from a filter which I have represented as a Mathematica transfer function object, ie. something of the form TransferFunctionModel[...]? I can easily extract the various parts of this object using array indices, but surely there is an "official" method?

I looked at the Mathematica documentation. But, for example, the coefficients used in In[101] here look like they've been copied manually from In[92], rather than obtained through a coefficient extraction function.


1 Answer 1


My first question would be why not use RecurrenceFilter[TransferFunctionModel[...],...].

There is more than one way to get the coefficients. The following will work for rational, scalar systems, without delays - which is what is handled by RecurrenceFilter.

tfd1 = TransferFunctionExpand[tfd][s][[1, 1]]

Reverse@CoefficientList[#, s] & /@ Through@{Denominator, Numerator}@tfd1

{{21, -25, 15, -3}, {1, 3, 3, 1}}

  • $\begingroup$ In answer to your question: I want to use Mathematica to derive my filter so I can use it somewhere else. Your solution is the same as mine but it didn't seem right to just unpack the internals of Mathematica's structure. $\endgroup$
    – Dan Piponi
    Sep 30, 2014 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.