3

I need to transform this Laplace function to the z-domain:

enter image description here

From the answer I received:

$s=(1-z^{−1})/T$

Then substitution into my Laplace function would give:

$t(z) = 2R/(m*(1-z^{−1})/T + 2R)$

Is that it?

Then $z$ is the input signal's current sample? Is $z^{-1}$ is the input signal delayed by one sample?

ie. Is it:

output_of_function = 2*R / (m* (1 - input_signal_1)/T + 2*R)

What basic mechanism might this function expect to perform? Eg. a LPF? Or what?

Does the fact that you're subtracting $z^{-1}$ from 1 imply that the input must be between -1 and 1?

Thanks. (I edited this in reply to the answer given from Matt L which helped.)

mike
  • 523
  • 2
  • 14

2 Answers2

6

First of all, it's important to understand that there is no single best way to transform a continuous-time system to a discrete-time system. The method you're using is called backward Euler method, and it is defined by the mapping

$$s\leftarrow\frac{1-z^{-1}}{T}\tag{1}$$

Note that in $(1)$ you scale by $1/T$, where $T$ is the sampling interval (i.e., $1/T$ is the sampling frequency). Eq. $(1)$ just means that continuous-time differentiation (multiplication by $s$) is approximated by a first-order backward difference ($z^{-1}$ corresponds to a delay by $1$ sample). This and other methods for converting continuous-time systems to discrete-time systems are discussed in this answer.

Here is an example where I chose an arbitrary frequency range of interest $f\in[0,10]$, and an appropriate sampling frequency $1/T=20$. The figure below shows the frequency response of the continuous-time system (in blue), and the frequency response of the discrete-time system (in green), which was transformed from the continuous-time system according to $(1)$.

enter image description here

Matt L.
  • 89,963
  • 9
  • 79
  • 179
  • Thanks Matt. It looks like my substitution for $s$ was wrong then. I updated my question based on your substitution given. Does it look right now? Can you answer any of the few small remaining questions in my post? Thanks. – mike Dec 04 '19 at 16:45
  • @mike: Multiplication by $z^{-1}$ in the transform domain corresponds to a delay by one sample. And 'no' to your question about the input required to be between -1 and +1. – Matt L. Dec 04 '19 at 17:45
  • Take a look at this question and its answers for more information on the Z-transform. – Matt L. Dec 04 '19 at 17:46
  • I would be strict and say $s \simeq \frac{1 - z^{-1}}{T}$ (note the $\simeq$ as opposed to $=$) for the backwards Euler. Also, depending on your problem, there's the forwards Euler, $s \simeq \frac{z - 1}{T}$, and the Tustin transformation: $s \simeq \frac{2(z - 1)}{T(z + 1)}$. None of these are exact, and every one of them gets less accurate as the frequency goes up, and there are other approximation methods. So pick your poison... – TimWescott Dec 05 '19 at 00:00
  • Thanks. For some reason the Euler didn't work at all. But the Tustin works perfectly. Maybe I fucked up the Euler but either way it's working with Tustin. – mike Dec 05 '19 at 03:41
  • @TimWescott: Of course it's an approximation, but the approximate sign is not what I mean, because I wanted to describe the mapping, which simply replace $s$ by the given expression. But I agree that the equality sign is also not what it should be, so I replaced it with an arrow for "maps to". – Matt L. Dec 05 '19 at 07:12
  • @MattL. I like the "maps to" notation. I'll try to remember it the next time I need to explain these approximations. – TimWescott Dec 05 '19 at 16:14
0

I don't know why but I couldn't get the equations to output any audio when using the Euler method given. Maybe I screwed it up somehow or this is not the best place for that type of approximation.

When I substituted $s=(2(z^{-1}−1))/(T(z^{-1}+1))$ it works perfectly. So problem solved either way. Thanks.

mike
  • 523
  • 2
  • 14
  • One of the properties of the Tustin approximation that the Euler approximations lack is that for a stable transfer function in $s$, the Tustin will give you a stable transfer function in $z$. With Euler, a transfer function with poles that are high frequency with respect to the sampling rate will end up being unstable. So it could be that your starting transfer function had one or more high-frequency poles in $s$ that mapped to an unstable pole in $z$ using the Euler method. – TimWescott Dec 05 '19 at 16:17