Discretizing a transfer function from s-domain (continuous) to z-domain (discrete) – x-engineer.org (2024)

Discretization is the process through which a continuous system (function/equation) is converted into a discrete system (function/equation). In engineering applications we use computers and microcontrollers to carry out computing and control tasks. These machines need discretized mathematical models of the control functions, which are suitable for numerical implementation and evaluation.

Every time a continuous system is discretized, there will be some level of discretization error. This happens because the discretized model is an approximation of the continuous model.

Image: Transfer function discretization

In the Control System domain, through discretization, a transfer function H(s) is converted from the s-domain (Laplace) into the z-domain (discrete) transfer function H(z).

There are several techniques (methods) for transfer function discretization, the most common being:

  • Forward Euler (difference) discretization
  • Backward Euler (difference) discretization
  • Trapezoidal (Tustin) discretization

As discretization example we are going to use the transfer function of a first order system (also known as a low-pass filter):

\[H(s) = \frac{1}{T_{c} \cdot s + 1} \tag{1}\]

where Tc [s] is the time constant of the system.

We can implement the first order system transfer function in an Xcos block diagram and plot its response to a step input.

Image: Continuous system – step input time response

This step input response is going to be used as a comparison baseline with the discretized systems.

Image: Step input system response – continuous system

Using the discretization methods above, we are going to convert the transfer function of the first order system H(s) from continuous time domain (s) to discrete time domain (z).

Forward Euler (difference) discretization

In the forward Euler discretization method, the variable s is replaced with:

\[s = \frac{z-1}{T_{s}} \tag{2}\]

where Ts [s] is the sampling time.The lower the value of the sampling time, the lower the discretization (quantization) error.

Replacing (2) in (1) and doing the several transformations and simplifications, we get (3):

\[ \begin{split}
H(z) &= \frac{1}{T_{c} \cdot \frac{z-1}{T_{s}} + 1} = \frac{1}{T_{c} \cdot \frac{z-1}{T_{s}} + \frac{T_{s}}{T_{s}}} = \frac{1}{\frac{1}{T_{s}} \left ( T_{c} \cdot (z-1) + T_{s} \right )} = \\
&= \frac{T_{s}}{T_{c} \cdot (z-1) + T_{s}} = \frac{T_{s}}{T_{c} \cdot z \cdot (1 – z^{-1}) + T_{s}} = \frac{T_{s} \cdot z^{-1}}{T_{c} \cdot (1 – z^{-1})+T_{s}}
\end{split} \]

We know that any transfer function of a system is defined as the ratio between the output and the input:

\[H(z) = \frac{Y(z)}{U(z)} \tag{4}\]

Replacing (4) in (3) gives:

\[\frac{Y(z)}{U(z)} = \frac{T_{s} \cdot z^{-1}}{T_{c} \cdot (1 – z^{-1})+T_{s}} \tag{5}\]

Multiplying the left and right members of the equation (5) gives:

\[ T_{s} \cdot U(z) \cdot z^{-1} = T_{c} \cdot \left ( Y(z) – Y(z) \cdot z^{-1} \right ) + Y(z) \cdot T_{s} \tag{6}\]

Next, we are making the following substitutions:

\[ \begin{split}
U(z) \cdot z^{-1} &= u[k-1] \\
Y(z) \cdot z^{-1} &= y[k-1] \\
Y(z) &= y[k]
\end{split} \]

where [k] is the calculation step. Rearranging the terms, gives:

\[T_{s} \cdot u[k-1] = y[k] \cdot \left ( T_{c} + T_{s} \right ) – T_{c} \cdot y[k-1] \tag{7}\]

which gives the expression of the output y[k] as:

\[ \bbox[#FFFF9D]{y[k] = \frac{1}{T_{c} + T_{s}} \left ( T_{s} \cdot u[k-1] + T_{c} \cdot y[k-1] \right )} \tag{8}\]

As you can see, the discretized version (forward Euler) of the first order system is made up entirely of algebraic operations. This allows the equation to be encoded into programming languages (like C, C++) and run on microcontrollers.

The [k] values represent the values at the current calculation step and the [k-1] values represent the values at the previous calculation step. For example u[k-1] is the value of the input signal at the previous calculation step and y[k-1] is the value of the output at previous calculation step.

To verify if the discretized function gives the same output for a step response as the continuous version (equation (1)), we are going to implement equation (8) in Xcos as a block diagram.

Image: Discrete system (forward Euler) for first order system – Xcos block diagram

Running the model with a sample time of 0.01 s will result in the same output as for the continuous system.

Image: Discrete system (forward Euler) for first order system – step input response

Backward Euler (difference) discretization

In the backward Euler discretization method, the variable s is replaced with:

\[s = \frac{z-1}{z \cdot T_{s}} = \frac{1 – z^{-1}}{T_{s}} \tag{9}\]

where Ts [s] is the sampling time.

Replacing (9) in (1) and doing the several transformations and simplifications, we get:

\[H(z) = \frac{1}{T_{c} \cdot \frac{1 – z^{-1}}{T_{s}} + 1} = \frac{T_{s}}{T_{c} \cdot (1 – z^{-1}) + T_{s}} \tag{10}\]

We know that any transfer function of a system is defined as the ratio between the output and the input:

\[H(z) = \frac{Y(z)}{U(z)} \tag{11}\]

Replacing (11) in (10) gives:

\[\frac{Y(z)}{U(z)} = \frac{T_{s}}{T_{c} \cdot (1 – z^{-1}) + T_{s}} \tag{12}\]

Multiplying the left and right members of the equation (12) gives:

\[ T_{s} \cdot U(z) = T_{c} \cdot \left ( Y(z) – Y(z) \cdot z^{-1} \right ) + Y(z) \cdot T_{s} \tag{13}\]

Next, we are making the following substitutions:

\[ \begin{split}
U(z) &= u[k] \\
Y(z) \cdot z^{-1} &= y[k-1] \\
Y(z) &= y[k]
\end{split} \]

and rearranging the terms, gives:

\[T_{s} \cdot u[k] = y[k] \cdot \left ( T_{c} + T_{s} \right ) – T_{c} \cdot y[k-1] \tag{14}\]

which gives the expression of the output y[k] as:

\[ \bbox[#FFFF9D]{y[k] = \frac{1}{T_{c} + T_{s}} \left ( T_{s} \cdot u[k] + T_{c} \cdot y[k-1] \right )} \tag{15}\]

To verify if the discretized function gives the same output for a step response as the continuous version (equation (1)), we are going to implement equation (15) in Xcos as a block diagram.

Image: Discrete system (backward Euler) for first order system – Xcos block diagram

Running the model with a sample time of 0.01 s will result in the same output as for the continuous system.

Image: Discrete system (forward Euler) for first order system – step input response

Trapezoidal (Tustin) discretization

In the backward Euler discretization method, the variable s is replaced with:

\[s = \frac{2}{T_{s}} \cdot \frac{z-1}{z+1} \tag{16}\]

where Ts [s] is the sampling time.

Replacing (16) in (1) and doing the several transformations and simplifications, we get (17):

\[ \begin{split}
H(z) &= \frac{1}{T_{c} \cdot \frac{2}{T_{s}} \cdot \frac{z-1}{z+1} + 1} = \frac{T_{s} \cdot (z+1)}{2 \cdot T_{c} \cdot (z-1) + T_{s} \cdot (z+1)} = \\
&= \frac{T_{s} \cdot z \cdot (1 + z^{-1})}{2 \cdot T_{c} \cdot z \cdot (1 – z^{-1}) + T_{s} \cdot z \cdot (1+z^{-1})} = \frac{T_{s} \cdot (1+z^{-1})}{2 \cdot T_{c} \cdot (1-z^{-1}) + T_{s} \cdot (1+z^{-1})}
\end{split} \]

We know that any transfer function of a system is defined as the ratio between the output and the input:

\[H(z) = \frac{Y(z)}{U(z)} \tag{18}\]

Replacing (18) in (17) gives:

\[\frac{Y(z)}{U(z)} = \frac{T_{s} \cdot (1+z^{-1})}{2 \cdot T_{c} \cdot (1-z^{-1}) + T_{s} \cdot (1+z^{-1})} \tag{19}\]

Multiplying the left and right members of the equation (19) gives:

\[ U(z) \cdot T_{s} \cdot (1+z^{-1}) = Y(z) \cdot 2 \cdot T_{c} \cdot (1-z^{-1}) + Y(z) \cdot T_{s} \cdot (1+z^{-1}) \tag{20}\]

Next, we are making the following substitutions:

\[ \begin{split}
U(z) &= u[k] \\
U(z) \cdot z^{-1} &= u[k-1] \\
Y(z) \cdot z^{-1} &= y[k-1] \\
Y(z) &= y[k]
\end{split} \]

and rearranging the terms, gives:

\[T_{s} \cdot (u[k] + u[k-1]) = y[k] \cdot (2 \cdot T_{c} + T_{s}) + y[k-1] \cdot (T_{s} – 2 \cdot T_{c}) \tag{21}\]

which gives the expression of the output y[t] as:

\[ \bbox[#FFFF9D]{y[k] = \frac{1}{2 \cdot T_{c} + T_{s}} \left ( T_{s} \cdot (u[k] + u[k-1]) – (T_{s} – 2 \cdot T_{c}) \cdot y[k-1] \right )} \tag{22}\]

To verify if the discretized function gives the same output for a step response as the continuous version (equation (1)), we are going to implement equation (22) in Xcos as a block diagram.

Image: Discrete system (trapezoidal) – step input time response

Running the model with a sample time of 0.01 s will result in the same output as for the continuous system.

Image: Discrete system (trapezoidal / Tustin) for first order system – step input response

The same conversion methodologies can be applied to any continuous transfer function, the discretized model having the advantage that can be implemented in digital / electronic control systems.

Discretizing a transfer function from s-domain (continuous) to z-domain (discrete) – x-engineer.org (2024)

FAQs

How to convert S-domain transfer function to Z-domain? ›

In the Control System domain, through discretization, a transfer function H(s) is converted from the s-domain (Laplace) into the z-domain (discrete) transfer function H(z). There are several techniques (methods) for transfer function discretization, the most common being: Forward Euler (difference) discretization.

What is the correct formula for the Tustin method of discretizing continuous-time transfer functions? ›

Tustin Approximation. The Tustin or bilinear approximation yields the best frequency-domain match between the continuous-time and discretized systems. This method relates the s-domain and z-domain transfer functions using the approximation: z = e s T s ≈ 1 + s T s / 2 1 − s T s / 2 .

What are the methods of discretization transfer function? ›

Discretization method

Available methods are: zero-order hold, Forward Euler, Backward Euler, and Bilinear (or Tustin).

What is the discretization of a system? ›

A. Discretization is the process of converting digital or binary data into a continuous function or system for more accurate computations in engineering domains. B.

How to convert continuous to discrete? ›

  1. Continuous-Discrete Conversion Methods.
  2. Zero-Order Hold. ZOH Method for Systems with Time Delays.
  3. First-Order Hold. FOH Method for Systems with Time Delays.
  4. Impulse-Invariant Mapping. Impulse-Invariant Mapping for Systems with Time Delays.
  5. Tustin Approximation. ...
  6. Zero-Pole Matching Equivalents. ...
  7. Least Squares.
  8. References.

How do I change my domain transfer? ›

Cancel your previous service.
  1. Make sure your domain is eligible for a transfer. ...
  2. Update your contact information. ...
  3. Set up your email sending domain name. ...
  4. Unlock your domain. ...
  5. Request an authorization code. ...
  6. Create an account with your new registrar. ...
  7. Enter the authorization code. ...
  8. Authorize the domain transfer.
Jan 16, 2023

What is the Tustin transformation method? ›

The bilinear transform (also known as Tustin's method, after Arnold Tustin) is used in digital signal processing and discrete-time control theory to transform continuous-time system representations to discrete-time and vice versa. with first order all-pass filters.

What are the methods of discretization? ›

Some popular discretization methods include the Finite Difference Method (FDM), Finite Element Method (FEM), Finite Volume Method (FVM), and Boundary Element Method (BEM), each having its own set of advantages and limitations.

How to convert continuous transfer function to discrete in Matlab? ›

Discretization method, specified as one of the following values:
  1. 'zoh' — Zero-order hold (default). ...
  2. 'foh' — Triangle approximation (modified first-order hold). ...
  3. 'impulse' — Impulse invariant discretization.
  4. 'tustin' — Bilinear (Tustin) method. ...
  5. 'matched' — Zero-pole matching method.
  6. 'least-squares' — Least-squares method.

What is discretization of a continuous function? ›

In applied mathematics, discretization is the process of transferring continuous functions, models, variables, and equations into discrete counterparts. This process is usually carried out as a first step toward making them suitable for numerical evaluation and implementation on digital computers.

How do you perform discretization? ›

Discretization is the process through which we can transform continuous variables, models or functions into a discrete form. We do this by creating a set of contiguous intervals (or bins) that go across the range of our desired variable/model/function. Continuous data is Measured, while Discrete data is Counted.

What is the difference between continuous and discrete state space? ›

Generally speaking, we refer to a discrete state/action space, when it is finite (or countable like Z). The term continuous state/action space corresponds to closed intervals like [−1,1] (or products of them).

How do you discretize continuous values? ›

Equal-width discretization consists of dividing the range of continuous values into k equally sized intervals. Then, if the values of the variable vary between 0 and 100, the bins can be 0–20, 20–40, 40–60, 80–100. We can carry out equal-frequency discretization in Python using the open source library Feature-engine.

What is the discretization of the domain? ›

The discretization of the domain allows one to calculate approximate solutions over each subdomain rather than over the entire domain. The solutions on the subdomains are represented by continuous functions at the nodes of these subdomains.

What does it mean when an equation is discretized? ›

Discretization is the name given to the processes and protocols that we use to convert a continuous equation into a form that can be used to calculate numerical solutions. Let' s start with some very simple examples.

What is the difference between Z domain and S domain? ›

While the continuous-time Fourier transform is evaluated on the s-domain's vertical axis (the imaginary axis), the discrete-time Fourier transform is evaluated along the z-domain's unit circle.

How do I transfer data from one domain to another domain? ›

Before you start moving your website, there are several steps you should take to make the process easier.
  1. Implement a Plan of Action. ...
  2. Cull and Clean Up Your Content. ...
  3. Review Your Site Structure. ...
  4. Decide if You Will Be Moving to a New Web Hosting Provider. ...
  5. Manual Backup. ...
  6. cPanel Backup Wizard. ...
  7. Plugins. ...
  8. Manual Transfer.

How to convert Laplace to Z-transform? ›

Laplace Transform can be converted to Z-transform by the help of bilinear Transformation. This transformation gives relation between s and z. s=(2/T)*{(z-1)/(z+1)} where, T is the sampling period. f=1/T , where f is the sampling frequency.

How do you convert Z domain to frequency domain? ›

Identify the discrete signal you want to analyze. In an oscilloscope, this would be the captured signal. In a signal generator, this might be the desired output signal of a digital filter. Apply the Z-Transform to the discrete signal to convert it into the frequency domain.

Top Articles
Latest Posts
Article information

Author: Francesca Jacobs Ret

Last Updated:

Views: 5835

Rating: 4.8 / 5 (48 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Francesca Jacobs Ret

Birthday: 1996-12-09

Address: Apt. 141 1406 Mitch Summit, New Teganshire, UT 82655-0699

Phone: +2296092334654

Job: Technology Architect

Hobby: Snowboarding, Scouting, Foreign language learning, Dowsing, Baton twirling, Sculpting, Cabaret

Introduction: My name is Francesca Jacobs Ret, I am a innocent, super, beautiful, charming, lucky, gentle, clever person who loves writing and wants to share my knowledge and understanding with you.