In this digital signal processing and discrete-time control tutorial, we explain how to calculate the magnitude (amplitude) and phase responses of discrete-time systems and filters. First, we briefly summarize the concept of the frequency response, and then we solve an example. We also explain the concepts of digital frequency, baseband, sampling frequency, and the relation of the digital frequency with the Nyquist frequencies and continuous time angular frequencies. In the second part of this tutorial, given here, we explain how to compute the phase and magnitude response of digital filters in Python.
The YouTube video accompanying this tutorial is given below.
Frequency Response Summary
The basic idea is to start from the transfer function of the discrete-time system that has the following form
(1)
where
(2)
where
(3)
As it will become completely clear after we solve an example, the expression (3) is a complex number or better to say a complex function of
(4)
where
is a function of that is called the magnitude response of the amplitude response of the system. is a function of that is called the phase response of the system.
There are a number of approaches for computing the phase and magnitude responses. We can use the polar form of a complex number to transform expressions in the numerator and denominator of
(5)
where
(6)
and the phase response is then computed by solving this equation
(7)
Before we explain how to compute the frequency response it is important to clarify several important things related to the digital frequency
(8)
where
First of all, the continuous-time sinusoidal signals are quantified by the continuous-time angular frequency
(9)
where
(10)
where
(11)
where
(12)
This is due to several important reasons. First of all, when analyzing discrete-time signals, we only take into account their continuous-time pairs that are in the frequency range from zero to the continuous-time frequency
(13)
is the angular sampling frequency and
(14)
That is, the maximal digital frequency that we can take into account is
(15)
The interval (15) is often referred to as the digital baseband or simply as baseband.
Another important thing to keep in mind is that due to sampling, the frequency response of the system is periodic with the period of
Also, the discrete-time transfer function
Example of Computing Phase and Frequency Response of Discrete-time (Digital) System (Filter)
Let us consider the following discrete-time system
(16)
where
(17)
using the following notation
(18)
, and the fact that
(19)
or
(20)
From the last equation, we have
(21)
This is the transfer function of the system. Let us compute the frequency response
(22)
From the last equation, we have
(23)
The idea for this transformation is to use this formula
(24)
to eliminate the difference between the complex exponentials and to compute the magnitude response.
From (23), we have
(25)
By using (24), from (25) we obtain
(26)
From this equation, we can conclude that the magnitude response is
(27)
At first sight, from (26) it looks like the phase response is
(28)
on the other hand, when
(29)
This means that the correct phase is given by
(30)
or
(31)
or finally
(32)
The phase and magnitude responses are shown in the figure below.
From the magnitude response, we can see that this system attenuates the low frequencies and the high frequencies are not attenuated. That is, this filter acts as a high-pass filter. These two graphs are generated by using the Python code that is explained in the tutorial given here.