# Laplace to Z transform for second order lag.

Started by May 15, 2004
```I have a problem with verifying the results for the conversion of a Laplace
transform to a z transform. The Laplace transform is in a table and is:

(b-a)/((s+a)*(s+b))

The z transform for this transfer function is:

( z*(exp(-a*T)-exp(-b*T))/((z-exp(-a*T)*(z-exp(-b*T))

Now let: a=1 b=2 T=.001  Where a and b are the poles and T is the sample
interval.

When s->0 the Laplace transfer functions gain is 1/2, but when z->1, the z
transfer function's gain is way to big.  I notice that if z transfer
function is multiplied by T then it approaches the correct value of 1/2 as T
gets smaller.  However the equations in the Laplace to z transform tables DO
NOT have a T in the numerator.  Are the tables wrongs or am I making some
wrong assumptions.  I have noticed that some of the other second order
conversions DO have T in the numerator.

I would be grateful for an explaination as to why this is so?

Peter Nachtwey

```
```Peter Nachtwey wrote:

> I have a problem with verifying the results for the conversion of a Laplace
> transform to a z transform. The Laplace transform is in a table and is:
>
> (b-a)/((s+a)*(s+b))
>
> The z transform for this transfer function is:
>
> ( z*(exp(-a*T)-exp(-b*T))/((z-exp(-a*T)*(z-exp(-b*T))
>
> Now let: a=1 b=2 T=.001  Where a and b are the poles and T is the sample
> interval.
>
> When s->0 the Laplace transfer functions gain is 1/2, but when z->1, the z
> transfer function's gain is way to big.  I notice that if z transfer
> function is multiplied by T then it approaches the correct value of 1/2 as T
> gets smaller.  However the equations in the Laplace to z transform tables DO
> NOT have a T in the numerator.  Are the tables wrongs or am I making some
> wrong assumptions.  I have noticed that some of the other second order
> conversions DO have T in the numerator.
>
> I would be grateful for an explaination as to why this is so?
>
> Peter Nachtwey
>

Because of the difference in representation between the z-domain and the
s-domain.  In the z-domain you either consider all values to be Dirac
delta functions and state their energy (in which case the s-domain
impulse and the z-domain impulse are the same thing), or you consider
all values to be "just numbers", and you define the impulse differently.

If you take the first case then the two transfer functions have the same
impulse response, but their step responses are different because the
s-domain step is a step, and the z-domain step is a train of impulses
where u(t) = sum(d(t - n*T))_n=0^{infinity}.

If you take the second case then the step functions mean the same thing
(more or less), but the output of the z-domain transfer function has a
different meaning than the s-domain transfer function.

In either case you cannot get a Laplace/z-transform pair that have the
same impulse and step response (except, perhaps for T(z) = T(s) = A, but
that's trivial).

You _can_, if you have a plant transfer function in the s-domain and a
sampled-time system with an ADC and DAC, get a model in the z-domain
that will tell you _exactly_ how the plant will behave at the ADC given
any DAC output.  You do this by modeling the DAC as a first-order hold
and the ADC as a "perfect sampler" that multiplies the input by a train
of pulses repeating every T seconds.

For a plant who's transfer function is T(s) = a/(s+a) you get:

T_z(s) = (1-e^{T s})/s * a/(s+a).

Do the partial-fraction expansion on this to get:

T_z(s) = (1-e^{-T*s}) * (a/s - a/(s+a)).

Do a z-transform to the pieces:

T_z(z) = (z-1)/z * (z/(z-1) - z/(z-d)), where d = e^{-T*a}.

Simplify:

T_z(z) = (z-1)/z * z(z-d - z + 1)/((z-1)(z-d)) = (1-d)/(z-d)

to get something that makes sense, has the right DC gain, and all that
wonderful stuff.

Note that you _cannot_ go back to the s-domain this way, because in
going from the continuous-time case to the sampled time case you're
taking advantage of the fact that the sampling happens at exactly 1/T,
so you can ignore it's effects on the z-domain system.  You _cannot_ do
this going back without running into mathematical difficulties of epic
proportions.  This means that you're stuck with doing all your analysis
in the z domain then verifying after the fact that the stair-step action
of the DAC doesn't cause you any problems with your real plant.

Usually the plant will act as a low-pass filter to the extent that any
edges in the DAC output will be filtered down to negligible proportions.
If not you'll need a reconstruction filter on the DAC which will mess
up your plant performance, driving you to higher sampling rates -- at
which point you may no longer need the reconstruction filter!

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
```
```Tim Wescott wrote:

> Peter Nachtwey wrote:
>
>> I have a problem with verifying the results for the conversion of a
>> Laplace
>> transform to a z transform. The Laplace transform is in a table and is:
>>
>> (b-a)/((s+a)*(s+b))
>>
>> The z transform for this transfer function is:
>>
>> ( z*(exp(-a*T)-exp(-b*T))/((z-exp(-a*T)*(z-exp(-b*T))
>>
>> Now let: a=1 b=2 T=.001  Where a and b are the poles and T is the sample
>> interval.
>>
>> When s->0 the Laplace transfer functions gain is 1/2, but when z->1,
>> the z
>> transfer function's gain is way to big.  I notice that if z transfer
>> function is multiplied by T then it approaches the correct value of
>> 1/2 as T
>> gets smaller.  However the equations in the Laplace to z transform
>> tables DO
>> NOT have a T in the numerator.  Are the tables wrongs or am I making some
>> wrong assumptions.  I have noticed that some of the other second order
>> conversions DO have T in the numerator.
>>
>> I would be grateful for an explaination as to why this is so?
>>
>> Peter Nachtwey
>>
>
> Because of the difference in representation between the z-domain and the
> s-domain.  In the z-domain you either consider all values to be Dirac
> delta functions and state their energy (in which case the s-domain
> impulse and the z-domain impulse are the same thing), or you consider
> all values to be "just numbers", and you define the impulse differently.
>
> If you take the first case then the two transfer functions have the same
> impulse response, but their step responses are different because the
> s-domain step is a step, and the z-domain step is a train of impulses
> where u(t) = sum(d(t - n*T))_n=0^{infinity}.
>
> If you take the second case then the step functions mean the same thing
> (more or less), but the output of the z-domain transfer function has a
> different meaning than the s-domain transfer function.
>
> In either case you cannot get a Laplace/z-transform pair that have the
> same impulse and step response (except, perhaps for T(z) = T(s) = A, but
> that's trivial).
>
> You _can_, if you have a plant transfer function in the s-domain and a
> sampled-time system with an ADC and DAC, get a model in the z-domain
> that will tell you _exactly_ how the plant will behave at the ADC given
> any DAC output.  You do this by modeling the DAC as a first-order hold
> and the ADC as a "perfect sampler" that multiplies the input by a train
> of pulses repeating every T seconds.
>
> For a plant who's transfer function is T(s) = a/(s+a) you get:
>
> T_z(s) = (1-e^{T s})/s * a/(s+a).
>
> Do the partial-fraction expansion on this to get:
>
> T_z(s) = (1-e^{-T*s}) * (a/s - a/(s+a)).
>
> Do a z-transform to the pieces:
>
> T_z(z) = (z-1)/z * (z/(z-1) - z/(z-d)), where d = e^{-T*a}.
>
> Simplify:
>
> T_z(z) = (z-1)/z * z(z-d - z + 1)/((z-1)(z-d)) = (1-d)/(z-d)
>
> to get something that makes sense, has the right DC gain, and all that
> wonderful stuff.
>
> Note that you _cannot_ go back to the s-domain this way, because in
> going from the continuous-time case to the sampled time case you're
> taking advantage of the fact that the sampling happens at exactly 1/T,
> so you can ignore it's effects on the z-domain system.  You _cannot_ do
> this going back without running into mathematical difficulties of epic
> proportions.  This means that you're stuck with doing all your analysis
> in the z domain then verifying after the fact that the stair-step action
> of the DAC doesn't cause you any problems with your real plant.
>
> Usually the plant will act as a low-pass filter to the extent that any
> edges in the DAC output will be filtered down to negligible proportions.
>  If not you'll need a reconstruction filter on the DAC which will mess
> up your plant performance, driving you to higher sampling rates -- at
> which point you may no longer need the reconstruction filter!
>

I think I've found the subject for my next article.  Thanks, Peter.
Watch this space, I'll announce it when I get it posted (which may be a
while; I've got some paying work that kinda takes precedence, dang it all).

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
```
```Tim Wescott wrote:

...

> Usually the plant will act as a low-pass filter to the extent that any
> edges in the DAC output will be filtered down to negligible proportions.
>  If not you'll need a reconstruction filter on the DAC which will mess
> up your plant performance, driving you to higher sampling rates -- at
> which point you may no longer need the reconstruction filter!

Thanks for a bang-up summary and rundown. With more like that, I may get
the hang of this stuff yet!

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;

```
```"Tim Wescott" <tim@wescottnospamdesign.com> wrote in message
news:10acq3fqko1645d@corp.supernews.com...
> Peter Nachtwey wrote:
>
> For a plant who's transfer function is T(s) = a/(s+a) you get:
>
> T_z(s) = (1-e^{T s})/s * a/(s+a).
>
> Do the partial-fraction expansion on this to get:
>
> T_z(s) = (1-e^{-T*s}) * (a/s - a/(s+a)).
>
> Do a z-transform to the pieces:
>
> T_z(z) = (z-1)/z * (z/(z-1) - z/(z-d)), where d = e^{-T*a}.
>
> Simplify:
>
> T_z(z) = (z-1)/z * z(z-d - z + 1)/((z-1)(z-d)) = (1-d)/(z-d)
>
Tim, this part explains my misunderstanding or bad assumption.  Specifically
the:

> For a plant who's transfer function is T(s) = a/(s+a) you get:
>
> T_z(s) = (1-e^{T s})/s * a/(s+a).
>
I forgot the ZOH part.  Now I will hide in a hole for a period of time for
forgeting that.

Thanks

Peter Nachtwey

```
```As Tim pointed out I forgot the ZOH.  This is (z-1)/(z*s).  This means that
for a second order lag I should have used:

z-1                a*b
----*Z(-------------------)
z          s*(s+a)*(s+b)

This works when the table entry

1
-------------------
s*(s+a)*(s+b)

is used.

Peter Nachtwey

```
```Peter Nachtwey wrote:
> As Tim pointed out I forgot the ZOH.  This is (z-1)/(z*s).  This means that
> for a second order lag I should have used:
>
> z-1                a*b
> ----*Z(-------------------)
>   z          s*(s+a)*(s+b)
>
> This works when the table entry
>
>          1
> -------------------
> s*(s+a)*(s+b)
>
> is used.
>
> Peter Nachtwey
>
>
>
>

You have a table entry for _that_?  What book are you using?

You realize, of course, that you don't need a table at all beyond the
1st-order stuff, because all the rest can be handled with partial
fraction expansion, even 2nd-order resonant polynomials if you allow
complex numbers.

MathCad is also good for this using their symbolic notation.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
```
```Scilab is also a good math package and it's free.
http://scilabsoft.inria.fr/

"Tim Wescott" <tim@wescottnospamdesign.com> wrote in message
news:10af91kp3c659b9@corp.supernews.com...
> You realize, of course, that you don't need a table at all beyond the
> 1st-order stuff, because all the rest can be handled with partial
> fraction expansion, even 2nd-order resonant polynomials if you allow
> complex numbers.
>
> MathCad is also good for this using their symbolic notation.

```
```"Tim Wescott" <tim@wescottnospamdesign.com> wrote in message
news:10af91kp3c659b9@corp.supernews.com...
> >
> > z-1                a*b
> > ----*Z(-------------------)
> >   z          s*(s+a)*(s+b)
> >
> > This works when the table entry
> >
> >          1
> > -------------------
> > s*(s+a)*(s+b)
> >
> > is used.
> >
> > Peter Nachtwey
> >
> >
> >
> >
>
> You have a table entry for _that_?  What book are you using?
>

I have a very good control book with Laplace to z transform tables called
"Digital Control System Analysis and Design" by Charles L Phillips and H.
Troy Nagle.   Another book I have with about the same table is "Control
Strategies for Dynamic Systems" by John H Lumkes who as a professor at MSOE.

> You realize, of course, that you don't need a table at all beyond the
> 1st-order stuff, because all the rest can be handled with partial
> fraction expansion, even 2nd-order resonant polynomials if you allow
> complex numbers.

Yes.  My books provide the converion up to second order equations.   Beyond
that I must use partial fractions.

>
> MathCad is also good for this using their symbolic notation.
>

doesn't do a direct conversion from the s to the z domain.   I find I need
to convert to the time domain and then substitute nT for t and then select n
and then do the conversion to the z domain.   Using a table or using Mathcad
makes no difference if you leave out the ZOH :(    I save all the transfer
functions in individual files that I can include using Insert->Reference.
Once is have these equations for the transfer functions there is little need
to regenerate them for each worksheet.  This is why I forgot about the ZOH.
I hadn't done this for awhile.

Peter Nachtwey

> --
>
> Tim Wescott
> Wescott Design Services
> http://www.wescottdesign.com

```
```Might you be from Milwaukee?

Gary

"Peter Nachtwey" <pnachtwey@comcast.net> wrote in message