fvtool
(To be removed) Visualize frequency response of DSP filters
Description
fvtool(
displays the magnitude
response of the filter System object™.sysobj
)
fvtool(
displays the response that is specified by the options.sysobj
,options
)
For example, to visualize the impulse response of an FIR filter System object, set options
to
"impulse"
.
Fs = 96e3; filtSpecs = fdesign.lowpass(20e3,22.05e3,1,80,Fs); firlp2 = design(filtSpecs,"equiripple",SystemObject=true); fvtool(firlp2,"impulse");
fvtool(____,
visualizes the
response of the filter with each specified property set to the specified
value.Name=Value
)
For more input options, see FVTool in Signal Processing Toolbox™.
Examples
Magnitude Response of Halfband Decimation Filter
Create two lowpass halfband decimation filters. The design
method in the first filter is set to "Equiripple"
and in the
second filter is set to "Kaiser"
.
Specify the filter order to be 52. Specify the transition width in normalized frequency units.
filterspec = "Filter order and transition width"; Order = 52; TW = 0.1859; firhalfbanddecimEqui = dsp.FIRHalfbandDecimator(... NormalizedFrequency=true,... Specification=filterspec,... FilterOrder=Order,... TransitionWidth=TW,... DesignMethod="Equiripple"); firhalfbanddecimKaiser = dsp.FIRHalfbandDecimator(... NormalizedFrequency=true,...... Specification=filterspec,... FilterOrder=Order,... TransitionWidth=TW,... DesignMethod="Kaiser");
Plot the magnitude response. If the filter specifications are tight, say a
very high filter order with a very narrow transition width, the filter
designed using the "Kaiser"
method converges more
effectively.
hfvtMag = fvtool(firhalfbanddecimEqui,firhalfbanddecimKaiser); legend(hfvtMag,["Equiripple","Kaiser"])
Input Arguments
sysobj
— Input filter
filter System object
Input filter, specified as one of the following filter System objects:
dsp.DCBlocker
(since R2024b)
Example: firFilt =
dsp.FIRFilter(Numerator=designLowpassFIR(FilterOrder=130,
CutoffFrequency=2000/(8000/2)));
fvtool(firFilt)
options
— Filter analysis options
'magnitude'
(default) | 'phase'
| 'freq'
| 'grpdelay'
| 'phasedelay'
| 'impulse'
| 'step'
| 'polezero'
| 'coefficients'
| 'info'
| 'magestimate'
| 'noisepower'
Filter analysis options, specified as one of the following:
'magnitude'
–– Magnitude response'phase'
–– Phase response'freq'
–– Frequency response'grpdelay'
–– Group delay'phasedelay'
–– Phase delay'impulse'
–– Impulse response'step'
–– Step response'polezero'
–– Pole zero plot'coefficients'
–– Coefficients vector'info'
–– Filter information'magestimate'
–– Magnitude response estimate'noisepower'
–– Round-off noise power spectrum
Example: fvtool(firFilt,'freq')
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: firFilt =
dsp.FIRFilter(Numerator=designLowpassFIR(FilterOrder=130,
CutoffFrequency=2000/(8000/2)));
fvtool(firFilt,Arithmetic="single")
Fs
— Sampling rate
scalar
Sampling rate, specified as a scalar. This value determines the
Nyquist interval [-Fs/2 Fs/2] in
which the fvtool
shows the frequency response of
the filters in the channelizer.
Data Types: single
| double
Arithmetic
— Arithmetic type
'double'
(default) | 'single'
| 'Fixed'
Specify the arithmetic used during analysis. The analysis tool assumes
a double-precision filter when the arithmetic input is not specified and
the filter System object is unlocked. The 'Arithmetic'
property set to 'Fixed'
applies only to filter System
objects with fixed-point properties.
When the 'Arithmetic'
property is set to
'Fixed'
, the tool shows both the double-precision
reference filter and the quantized version of the filter. The
CoefficientsDataType
property in the respective
filter System object is used in creating the quantized version of the filter
for all the analyses options except for the two below:
'magestimate'
–– Magnitude response estimate.'noisepower'
–– Round-off noise power spectrum
For these two analyses options, all the fixed-point settings are used in analyzing the quantized version of the filter.
Version History
Introduced before R2006aR2024b: fvtool
will be removed
The fvtool
function will be removed in a future release. Use
filterAnalyzer
instead. The fvtool
and
filterAnalyzer
functions perform differently, and using
filterAnalyzer
requires updates to your code.
Consider these filters:
[b,a] = ellip(5,5,60,[0.2 0.45]); dFd = dsp.FIRFilter;
This table shows how to update existing code.
Original Code in R2024a or Earlier | Updated Code in R2024b |
---|---|
fvtool(b,a,dFd) |
filterAnalyzer(b,a,dFd) |
fvtool(b,a,dFd,Analysis="freq") |
filterAnalyzer(b,a,dFd,... Analysis="magnitude",Overlay="phase") |
fvtool(b,a,Fs=1000) |
filterAnalyzer(b,a,SampleRates=1000) |
fvtool(b,a,dFd,NumberofPoints=512, ... FrequencyRange="[0, 2pi)",FrequencyScale="Log") |
filterAnalyzer(b,a,dFd,NFFT=512, ... FrequencyRange="twosided",FrequencyScale="log") |
hfvt = fvtool(dFd); addfilter(hfvt,dfilt.df1(b,a)) |
fa = filterAnalyzer(dFd); addFilters(fa,b,a) |
hfvt = fvtool(dFd); setfilter(hfvt,dfilt.df1(b,a)) |
fa = filterAnalyzer(dFd,FilterNames="df"); replaceFilters(fa,b,a,FilterNames="df") |
hfvt = fvtool(b,a,dFd); deletefilter(hfvt,2) |
fa = filterAnalyzer(b,a,dFd,FilterNames=["ba" "dFd"]); deleteFilters(fa,FilterNames="dFd") |
hfvt = fvtool(b,a,dFd); legend(hfvt,"ba","dFd") |
filterAnalyzer(b,a,dFd,FilterNames=["ba" "dFd"]) |
hfvt = fvtool(b,a,dFd); zoom(hfvt,[0.4 0.7 -30 0]) |
fa = filterAnalyzer(b,a,dFd); zoom(fa,"xy",[0.4 0.7 -30 0]) |
fvtool(b,a,dFd,Analysis="noisepower") |
filterAnalyzer(b,a,dFd,Analysis="noisepsd") |
The second order sections (SOS) format is not supported in Filter
Analyzer. Use the CTF format instead. Given a filter specified as an SOS
matrix sos
, you must make the following updates to your
code.
Original Code in R2024a or Earlier | Updated Code in R2024b |
---|---|
fvtool(sos) | filterAnalyzer(sos(:,1:3),sos(:,4:6)) or [ctfNum,ctfDen] = sos2ctf(sos); filterAnalyzer(ctfNum,ctfDen) |
hfvt = fvtool(sos); set(hfvt.SOSViewSettings,View="cumulative") |
[ctfNum,ctfDen] = sos2ctf(sos); fa = filterAnalyzer(ctfNum,ctfDen,CTFAnalysisMode="cumulative"); |
hfvt = fvtool(sos); set(hfvt.SOSViewSettings,View="userdefined",UserDefined={3,1}) |
[ctfNum,ctfDen] = sos2ctf(sos); fa = filterAnalyzer(ctfNum,ctfDen, ... CTFAnalysisMode="specify",CTFAnalysisSections={3,1}); |
R2024b: dsp.BiquadFilter
object warns
The dsp.BiquadFilter
object issues a warning and will be removed
in a future release. Use the dsp.SOSFilter
object instead. For more information on how to replace
your existing code, see the Compatibility Considerations
section in the dsp.BiquadFilter
reference page.
R2024b: Support for dsp.DCBlocker
object
Starting in R2024b, this function supports the dsp.DCBlocker
object.
R2023b: Support for dsp.ParallelFilter
and dsp.Delay
Objects
Starting in R2023b, the fvtool
analysis function supports the
dsp.ParallelFilter
and the dsp.Delay
objects.
R2023b: dsp.BiquadFilter
object will be removed
The dsp.BiquadFilter
object will be removed in a future release.
Use the dsp.SOSFilter
object instead.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)