Signal Processing Toolbox | ![]() ![]() |
Syntax
freqzplot(h,w) freqzplot(h,w,s)
Description
freqzplot(h,w)
plots the frequency response data contained in h
at the frequencies specified in the vector w
, where h
can be either a vector or a matrix. w
must be a vector whose length is the number of rows in h
. The data in h
is plotted versus frequency w
on two plots:
h
is plotted in dB.h
is plotted in degrees.The units for frequency on the plots are in radians per sample. If h
is a matrix, the frequency responses of each column of h
is plotted.
freqzplot(h,w,s)
specifies a structure of plotting options, s
, with the following fields:
s.xunits
- a string specifying the frequency axis units. The contents of s.xunits
can be one of the following:'rad/sample'
(default)'Hz'
'kHz'
'MHz'
'GHz'
s.yunits
- a string specifying the vertical axis units. The contents of s.yunits
can be one of the following:'dB'
(default)'linear'
'squared'
s.plot
- a string specifying the type of plot to produce. The contents of s.plot
can be one of the following:'both'
(default)'mag'
'phase'
Note that the s
structure can be obtained as an output of freqz
.
Examples
nfft = 512; Fs = 44.1; % Fs is in kHz. [b1,a1] = cheby1(5,0.4,0.5); [b2,a2] = cheby1(5,0.5,0.5); [h1,f,s] = freqz(b1,a1,nfft,Fs); h2 = freqz(b2,a2,nfft,Fs);% Use the same nfft and Fs. h = [h1 h2]; s.plot = 'mag'; % Plot the magnitude only. s.xunits = 'khz'; % Label the frequency units correctly. s.yunits = 'squared'; % Plot the magnitude squared. freqzplot(h,f,s); % Compare the two Chebyshev filters.
See Also
freqz |
Compute and plot the frequency response of a filter. |
grpdelay |
Compute the average filter delay. |
psdplot |
Plot power spectral density (PSD) data. |
![]() | freqz | gauspuls | ![]() |