How to Calculate the Impulse Response in MATLAB?
Last Updated :
09 Nov, 2022
Impulse response δ(t) is defined as the output signal that is the result of applying an impulse to a system. The system could be signal filter as well. Physical understanding of the impulse response of a system is highly useful for understanding a dynamic system. In this article, we shall see how to calculate impulse of a digital filter and dummy dynamic systems using the in-built functionalities of MATLAB.
MATLAB provides following functions for calculating the impulse responses.
- impulse(system) – Calculates impulse response of a dynamically defined system.
- impz() – Calculates impulse response of digital filters.
Impulse Response of Dynamic Systems:
We will create state space of 2nd order in four variables using the ss() function of MATLAB. It must be noted that you must have one of the following installed for running this function:
- Control System Toolbox
- DPS system Toolbox
- Model Predictive Control Toolbox
- Signal Processing Toolbox
This is necessary as the state-space function is part of this products and not basic MATLAB. Now, we shall create a dummy system for illustration of the impulse() function. See the following example for the same.
Example 1:
Matlab
a = [-0.45572,-0.732814; 0.732814,0];
b = [-1, 1; 2 -3];
c = [0.2 -3.543];
sys = ss(a, b, c, 0);
impulse(sys)
|
Output:
This would show the impulse response as a graphical signal.
Impulse Response of a Digital Filter:
As mentioned earlier, MATLAB provides functionality for calculating the impulse response of digital functions as well. For instance, we shall create a dummy fifth order elliptic filter from the Signal Processing Toolbox of MATLAB.
Example 2:
Matlab
[b,a] = ellip(5,0.23,23,0.55);
impz(b,a,75)
|
Output:
This calculates impulse response at of the elliptic filter at fifth order for 75 sample points.
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...