To plot the frequency response of a low pass filter in MATLAB, follow the steps below:
butter
, cheby1
, or ellip
. For example, to design a low pass Butterworth filter of order 4 with normalized cut-off frequency of 0.2, use the following command:main.m25 chars2 lines
freqz
function to compute and plot the frequency response of the filter. The freqz
function takes the filter coefficients as inputs and returns the complex frequency response and the frequency vector. To plot the magnitude response of the filter, use the abs
function on the frequency response, and to plot the phase response, use the angle
function. For example, to plot the magnitude and phase responses of the filter, use the following commands:main.m314 chars12 lines
This will result in a plot with the magnitude and phase responses of the low pass filter.
gistlibby LogSnag