5
$\begingroup$

the function c2d allows to convert a continuous laplace transfer function to a discrete z-transform transfer function. The base method is the Zero Order Holder. In example:

   s=tf('s');
   P=3/(3+s);
   Pd=c2d(P,0.1); % 0.1 is the sampling time

Produces

$$ \frac{0.25918178 }{z - 0.74081822068} $$

$0.74081822068 = e^{-0.1 \ \cdot \ 3}$ as expected.

If we had a delay to the tf such as

$$ e^{-2 s} \ \frac{3}{3+s} $$

the conversion will result obviously in:

$$ z^{-20} \ \frac{0.25918178 }{z - 0.74081822068}$$

But if we introduce a delay not multiple of $0.1$ like this:

$$ e^{-1.95 \ s} \ \frac{3}{3+s} $$

it will produce:

$$ z^{-20} \ \frac{0.1393 z + 0.1199}{z - 0.7408} $$

As stated here, for "ZOH Method for Systems with Time Delays":

  1. Decomposes the delay $\tau$ as $\tau=kT+\rho$ with $0\le\rho<\tau$
  2. Absorbs the fractional delay $\rho$ into $H(s)$.

I ask how it is done the second step (if it is known), so how are calculated the coefficient of the numerator

$$ 0.1393 z + 0.1199 $$

and why that algorithm adds a zero to the transfer function and increases the order of the numerator to compensate the fractional delay. Actually, the algorithm seems provide good results:

enter image description here

Thank you.

$\endgroup$
9
  • $\begingroup$ Can I show you how to do $\LaTeX$ markup for your math? And then you'll use that in the future? $\endgroup$ Nov 10, 2023 at 16:22
  • 1
    $\begingroup$ @robertbristow-johnson of course, thank you very much, sorry, it is my first question! $\endgroup$ Nov 10, 2023 at 16:27
  • $\begingroup$ Hay, just FYI, you had the $z$ is the numerator in your original posting. Removing it from the numerator is just like multiplying by $z^{-1}$, which adds a delay of one sample to the transfer function. Does that enter into your accounting of total delay? $\endgroup$ Nov 10, 2023 at 18:47
  • 1
    $\begingroup$ Sorry @robertbristow-johnson I do not understand your point. I need to find $$ {(1-z^{-1}) \mathcal{Z}{ \left\\{ \mathcal{L^{-1}} \left\\{ \frac {1}{s} \left(\frac{3}{3+s} \right) \right\\}\right\\}}} $$ and this result in $$ \frac{0.25918178}{z−0.74081822068} $$ . No z at numerator. $\endgroup$ Nov 14, 2023 at 10:47
  • 1
    $\begingroup$ Is this the expression you meant to say? $$ (1-z^{-1}) \mathcal{Z} \left\{ \mathscr{L^{-1}} \left\{ \frac{1}{s} \left( \frac{3}{3+s} \right) \right\} \right\} $$ $\endgroup$ Nov 15, 2023 at 22:08

1 Answer 1

3
$\begingroup$

The zero-order hold (ZOH) discretization is the same as the step-invariant method, which means that the step response of the discrete-time system equals the continuous-time step response at the sample instants. That's what is shown in the figure in your question.

The calculation of the discrete-time transfer function is performed as follows: factoring out a delay of $20$ samples, we're left with the following continuous-time transfer function:

$$H(s)=\frac{3e^{\tau s}}{s+3},\qquad \tau=0.05\tag{1}$$

The Laplace transform of the step response is

$$G(s)=\frac{H(s)}{s}=\frac{3e^{\tau s}}{s(s+3)}=e^{\tau s}\left(\frac{1}{s}-\frac{1}{s+3}\right)\tag{2}$$

The corresponding step response is

$$g(t)=\left(1-e^{-3(t+\tau)}\right)u(t+\tau)\tag{3}$$

For the ZOH (step-invariant) discretization we require the step response of the discrete-time system to be

\begin{align*} g_d[n] = g(nT) &= \left(1-e^{-3(nT+\tau)}\right)u(nT+\tau)\\ &= \left(1-e^{-3\tau}\left(e^{-3T}\right)^n\right)u[n]\tag{4} \end{align*}

where $T$ is the sampling interval. The discrete-time unit step sequence $u[n]$ equals $u(nT+\tau)$ because $|\tau|<T$.

The $\mathcal{Z}$-transform of $(4)$ is

$$G_d(z)=\frac{1}{1-z^{-1}}-\frac{e^{-3\tau}}{1-e^{-3T}z^{-1}}\tag{5}$$

The transfer function of the discrete-time system is

\begin{align*} H_d(z)=(1-z^{-1})G_d(z) &= 1-e^{-3\tau}\frac{1-z^{-1}}{1-e^{-3T}z^{-1}}\\ &= \frac{1-e^{-3\tau}+\left(e^{-3\tau}-e^{-3T}\right)z^{-1}}{1-e^{-3T}z^{-1}}\tag{6} \end{align*}

With $\tau=0.05$ and $T=0.1$ you obtain exactly the numbers returned by Matlab.

$\endgroup$
1
  • 2
    $\begingroup$ If found myself Friday this same solution, I would write it, but you come earlier. Happy that I was right! Thank you. $\endgroup$ Nov 13, 2023 at 16:21

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.