# How can I get the continuous-time transfer function coefficients (or poles and zeros) from the corresponding discrete-time TF and vice versa?

Let's say I have a continuous time transfer function which I know its numerator coefficients $$(B^c = [b^c_m, ..., b^c_1, b^c_0])$$ and denominator coefficients $$(A^c = [a^c_m, ..., a^c_1, a^c_0])$$. Also I know its zeros $$(Z^c = [z^c_m, ..., z^c_1])$$, and poles $$(P^c = [p^c_m, ..., p^c_1])$$ and gain $$K^c$$.

How can I get the numerator $$(B^d = [b^d_m, ..., b^d_1, b^d_0])$$, denominator $$(A^d = [a^d_m, ..., a^d_1, a^d_0])$$, zeros $$(Z^d = [z^d_m, ..., z^d_1])$$, poles $$(P^d = [p^d_m, ..., p^d_1])$$, and gain $$K^d$$ of an equivalent discrete-time transfer function (considering sampling time of $$T_s$$)

I know about the transformation methods (like Tustin or bilinear approximation), but those transformation methods convert the transfer function from continuous to discrete and it is not obvious from that how the numerator and denominator coefficients change. In other words I need the implementation of two functions like below:

$$[A^d, B^d] = \text{function_1} \,(A^c, B^c)$$ $$[Z^d, P^d, K^d] = \text{function_2} \,(Z^c, P^c, K^c)$$

I know for function_1 there is a Matlab function called c2d() which does that, but that is not compatible with Matlab coder, and I need to write my own function. So that is why I am interested to know the explicit mathematical formulas that does the conversion between coefficients (or zeros and poles) and not the transfer function.

For the function_2 maybe I have the answer but I am not sure it can handle all cases (including single/multiple poles or zeros):

$$Z^d = e^{Z^c \times T_s}$$

$$P^d = e^{P^c \times T_s}$$

$$K^d = 1-e^{-K^c \times T_s}$$ ---> (is the minus sign right?)

• do you mean Laplace to Z ($H_\mathrm{ct}(s)$ to $H_\mathrm{dt}(z)$)? or continuous-time Fourier Transform to DTFT ($H_\mathrm{ct}(j\Omega)$ to $H_\mathrm{dt}(e^{j\omega})$)? – robert bristow-johnson Dec 5 '18 at 0:44
• i guess it's the same either way. – robert bristow-johnson Dec 5 '18 at 0:45
• this is in the textbooks. do you have one of them? the two most prominent methods are bilinear transform (which is Tustin) and impulse invariant. – robert bristow-johnson Dec 5 '18 at 0:47
• Have you seen this? Aren't all the formulas there that you need? – Matt L. Dec 5 '18 at 8:22
• I did not mean the conversion of transfer functions, what I am more interested is the direct relation between numerators and denominators after this conversion, or poles and zeros. I tried to explain the problem in a different way. Hope it is now clear. – shampar Dec 5 '18 at 19:20

This is the formula that you need: $$H_d(z) = H_a \left( j\frac{2}{T} \tan(\omega_d T/2) \right),$$ where $$H_a(s)$$ is the transfer function in the Laplace domain, and $$\omega_d$$ is the "warping frequency", i.e. the frequency where you want the transfer functions to line up exactly (usually chosen as the cutoff frequency or center frequency).
• uhm, don't you need an $s$ in there on the right hand side, Carlos? – robert bristow-johnson Dec 5 '18 at 0:50
• i see the reference (in Wikipedia) you pointed to. who put the fucking $\omega_d$ in there? i was the original writer of that section (i think) and i didn't use that symbol. should be $s=j\Omega$ in the continuous-time world and $z=e^{j\omega}$ in the discrete-time world. – robert bristow-johnson Dec 5 '18 at 0:51