Discrete Transfer Functions
Contents
- Tags
- Digital Filters
Continuous to discrete transfer function
In order to convert an analog filter (Laplace domain) to a digital filter (z-domain), the c2d command can be used (doc).
Let’s define a simple first order low pass filter in the Laplace domain:
|
|
To obtain the equivalent digital filter:
|
|
There are several methods to go from the analog to the digital domain, Tustin is the one I use the most as it ensures the stability of the digital filter provided that the analog filter is stable.
Obtaining analytical formula of filter
Procedure
The Matlab Symbolic Toolbox can be used to obtain analytical formula for discrete transfer functions.
Let’s consider a notch filter:
\begin{equation} G(s) = \frac{s^2 + 2 g_c \zeta \omega_n s + \omega_n^2}{s^2 + 2 \zeta \omega_n s + \omega_n^2} \end{equation}
with:
- \(\omega_n\): frequency of the notch
- \(g_c\): gain at the notch frequency
- \(\zeta\): damping ratio (notch width)
First the symbolic variables are declared (Ts is the sampling time, s the Laplace variable and z the “z-transform” variable).
|
|
Then the bi-linear transformation is performed to go from continuous to discrete:
|
|
The symbolic formula of the notch filter is defined:
|
|
Finally, the numerator and denominator coefficients can be extracted:
|
|
|
|
|
|
Second Order Low Pass Filter
Let’s consider a second order low pass filter:
\begin{equation} G(s) = \frac{1}{1 + 2 \zeta \frac{s}{\omega_n} + \frac{s^2}{\omega_n^2}} \end{equation}
with:
- \(\omega_n\): Cut off frequency
- \(\zeta\): damping ratio
First the symbolic variables are declared (Ts is the sampling time, s the Laplace variable and z the “z-transform” variable).
|
|
Then the bi-linear transformation is performed to go from continuous to discrete:
|
|
The symbolic formula of the notch filter is defined:
|
|
Finally, the numerator and denominator coefficients can be extracted:
|
|
|
|
|
|
|
|
And the transfer function is equal to gain * num/den.
Second Order Low Pass Filter
Let’s consider a second order low pass filter:
\begin{equation} G(s) = \frac{g}{ms^2 + cs + k} \end{equation}
First the symbolic variables are declared (Ts is the sampling time, s the Laplace variable and z the “z-transform” variable).
|
|
Then the bi-linear transformation is performed to go from continuous to discrete:
|
|
The symbolic formula of the notch filter is defined:
|
|
Finally, the numerator and denominator coefficients can be extracted:
|
|
|
|
|
|
|
|
And the transfer function is equal to gain * num/den.
Second Order High Pass Filter
Let’s consider a second order low pass filter:
\begin{equation} G(s) = \frac{1}{1 + 2 \zeta \frac{s}{\omega_n} + \frac{s^2}{\omega_n^2}} \end{equation}
with:
- \(\omega_n\): Cut off frequency
- \(\zeta\): damping ratio
First the symbolic variables are declared (Ts is the sampling time, s the Laplace variable and z the “z-transform” variable).
|
|
Then the bi-linear transformation is performed to go from continuous to discrete:
|
|
The symbolic formula of the notch filter is defined:
|
|
Finally, the numerator and denominator coefficients can be extracted:
|
|
|
|
|
|
|
|
And the transfer function is equal to gain * num/den.
Variable Discrete Filter
Once the analytical formula of a discrete transfer function is obtained, it is possible to vary some parameters in real time.
This is easily done in Simulink (see Figure 1) where a Discrete Varying Transfer Function block is used.
The coefficients are simply computed with a Matlab function.

Figure 1: Variable Discrete Filter in Simulink