Im confused by Matlab's dontinuous-to-discrete conversion methods and how they work

203 views (last 30 days)
Dominik Hiltbrunner
Dominik Hiltbrunner on 27 Oct 2020
Commented: Tamas Kis on 10 Apr 2021
Hello community
Recently, I have been working a lot with the transformation from the s-domain to the z-somain using Matlab's c2d function. Currently I'm trying to get an overview about the different discretization methods, i.e. how do they work and when to use them. I'm confused by the notation Matlab uses compared to other literature. Everything I am asking is related to this documentation.
All I am interested in are transfer functions in the continuous-time and discrete-time domain. Meaning that given a transfer function , which steps do I have to perform to get the transfer function . This is what I came up with so far:
Can someone help me complete this table?
Furthermore, there are some more questions associated to this topic
1) As far as I understood, not every transformation is a simple substitution of the variable s. However, is it possible to give a general relationship between the transfer function in the s-domain and z-domain for all cases?
2) According to the documentation, zero-order hold and first-order hold are used best for good matching in the time dimain for "staircase" and "piecewise linear" inputs. I do not know what to do with this information, i.e. why would an analog system be driven by such signals. What is the connection here?
3) Zero-Pole Matching should be used for good matching in the frequency domain according to Matlab's documentation. However, other sources state that this is not the case. I link the related Wikipedia article here (more sources stating this are cited there). In my case I am interested in modelling analog audio components in the digital domain. Hence, precise matching of the frequency response is important. Now I am not sure whether Zero-Pole matching is a good method or not.
4) The Tustin approximation also yields good matching in the frequency domain according to the documentation. From a theoretical point of view this cannot be true in general since the whole frequency axis is wrapped around the unit circle in a non-linear matter, i.e. there must be frequency distortion. The documentation further introduces the concept of the prewrapper frequency, which allows to capture the dynamics of an analog system on a particular frequency. This all yields to the same question as above: If I want to copy the behaviour of an system with audio frequencies (0Hz - 20 kHz), is this method suitable or not?
5) One transformation which I could not find in Matlab is the backwards difference. This transformation is used e.g. in Simulink for the discrete-time derivative block (assuming that a derivative in the continuous domain has the ideal transfer function ). I'm not sure whether this substitution even es a real transformation since I was unable to find related literature. Somebody has more information about it?
6) Why can I not use some transformations for non-causal systems? For example, I want to converte an (ideal) continuous-time derivative:
s = tf('s');
Ts = 5; % Sampling period
Gs = s; % Continuous-time TF
Gz = c2d(Gs,Ts,'impulse'); % Discrete-time TF
This gives an error for any method except Tustin's approximation and Zero-Pole matching. I know that there are stability issues, i.e. a contunuous-time derivative is unstable per definition and some transformation map a stable analog system to an unstable discrete system. Is this the problem? And why can Tustin's methor or Zero-Pole mapping handle this?

Accepted Answer

Paul
Paul on 28 Oct 2020
Edited: Paul on 30 Oct 2020
I'll give an initial answer and then come back and edit if you have any more questions.
As far as the table goes:
The Zero-order Hold method is called just that, i.e., the zero-order hold approximation. It is not the Forward Difference or Euler's method (there was actuallly another post a few weeks ago where this same subject came up). For example:
>> H=tf([1 1],conv([1 2],[1 3])) % simple transfer function
H =
s + 1
-------------
s^2 + 5 s + 6
Continuous-time transfer function.
>> Ts = 0.1;
>> Hd = c2d(H,Ts,'zoh') % zoh approximation
Hd =
0.08215 z - 0.07432
---------------------
z^2 - 1.56 z + 0.6065
Sample time: 0.1 seconds
Discrete-time transfer function.
>> s = tf([1 -1],Ts,Ts) % forward difference substitution
s =
z - 1
-----
0.1
Sample time: 0.1 seconds
Discrete-time transfer function.
>> minreal((s + 1)/(s*s + 5*s + 6)) % sub into original transfer function, not the same as zoh approximation
ans =
0.1 z - 0.09
------------------
z^2 - 1.5 z + 0.56
Sample time: 0.1 seconds
Discrete-time transfer function.
I think that the transformation in your third column is correct for the Forward Difference method. As far as I know, the CST doesn't support the Forward Difference or Backward Difference methods, at least not officially (see below) which is suprising to me.
The zoh and foh and impulse invariant and zero-pole matching methods can't be described in terms of a simple substitution between s and z, like can be done for Tustins method. But the zoh and impulse invarant and zero-pole matching methods are pretty straightforward. I'm not as familiar with the foh method.
Impulse invariant mapping is often called impulse invariance.
Reference [2] in the doc page you linked is a very good resource.
As to your other questions:
1. I don't understand what you mean by a "general relationship." Can you clarify?
2. Suppose you have an analog device that is being driven a compute that develops inputs to the device in discrete time. In order to link the device to the computer, you have to convert the discrete time signal into an an analog signal, i.e., a D-to-A converter. A D-to-A converter that maintains a constant signal until the next discrete time update by the the computer is a zero-order-hold. A first-order-hold extrapolates linearly until the next computer update. Hence, the zoh and foh methods, IMO, are primarily appropriate when you need a discrete model of an analog system with a D-to-A at its input. Others may disagree.
3. Zero-pole matching or any of the other non-hold methods may or may not be what you need. You should try them all for your application, plot up responses of interest, and see which result gives you the best answer for your use case.
4. All of the methods will result in some distortion as the frequency approaches the Nyquist frequency, some more than others.The prewarp frequency with Tustin's method yields the perfect match at the prewarp frequency, not over a range of frequencies. An example of when you might want to use pre-warping would be if you had an analog notch filter and you want its discrete apprximation to be perfectly matched at the notch frequency.
5. c2d does not support forward or backward difference, Well, at least not officially. This actually works, though undocumented
c2d(H,T,'forward')
Edit: Actually, it doesn't work. See comment below.
6. I think the short answer here, and I don't mean to be flip, is that the math doesn't work out for those methods. For example, the impulse invariant method is defined in terms of samples of the continuous time impulse response of the continuous time transfer function. The impulse response of H(s) = s is the derivative of the Dirac delta function. How can that function be sampled at t=0?
  10 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by