replaceFilters
Description
replaceFilters(
replaces all the filters in the Filter Analyzer app
fa
,filt
1,...,filt
n)fa
with new filters. The number of specified filters must be equal to
the total number of filters currently in the app. If you want to replace only a subset of
the filters, use the FilterNames
argument to specify which ones.
replaceFilters(___,
specifies options using name-value arguments in addition to the input arguments from the
previous syntax.Name=Value
)
Examples
Replace Existing Filters
Start the Filter Analyzer app with one lowpass filter.
d1 = designfilt("lowpassfir", ... PassbandFrequency=0.45,StopbandFrequency=0.55); fa = filterAnalyzer(d1,FilterNames="LP");
Replace the lowpass filter with a highpass filter.
d2 = designfilt("highpassfir", ... PassbandFrequency=0.55,StopbandFrequency=0.45); replaceFilters(fa,d2,FilterNames="LP") renameFilters(fa,"LP","HP")
Input Arguments
fa
— Filter Analyzer app handle
filterAnalyzer
object
Filter Analyzer app handle, specified as a filterAnalyzer
object.
filt
— Input filters
coefficient matrices | cell array | digitalFilter
object | filter System object™
Input filter, specified as coefficient matrices, a cell array, a
digitalFilter
object, or a filter
System object.
For more information, see Import Filter on the Filter Analyzer page..
Example: b = [1 3 3 1]/6
and a = [3 0 1
0]/3
together specify a third-order lowpass Butterworth filter with a
normalized 3-dB frequency of 0.5π rad/sample.
Example: sos2ctf([2 4 2 6 0 2; 3 3 0 6 0 0])
specifies a
third-order lowpass Butterworth filter with a normalized 3-dB frequency of
0.5π rad/sample.
Example: d =
designfilt("lowpassiir",FilterOrder=3,HalfPowerFrequency=0.5)
specifies
a third-order lowpass Butterworth filter with a normalized 3-dB frequency of
0.5π rad/sample.
Example: hd =
design(fdesign.lowpass,"butter",SystemObject=true)
specifies a lowpass
Butterworth filter System object.
Filter Coefficients
You can use Filter Analyzer to analyze filters specified as numerator and denominator coefficients. If you specify the coefficients as the L-row matrices
Filter Analyzer assumes you have specified the filter as a sequence of L cascaded transfer functions (CTF), such that the full transfer function of the filter is
where m ≥ 0 is the numerator order of the filter and n ≥ 0 is the denominator order.
If L = 1, then B and A are row vectors that specify the transfer function of an IIR filter.
If you specify both B and A as column vectors, Filter Analyzer assumes they represent the transfer function of an IIR filter.
If B is a scalar, Filter Analyzer assumes you specified the filter as a cascade of all-pole IIR filters with each section having a scaling gain equal to B.
If A is a scalar, Filter Analyzer assumes you specified the filter as a cascade of FIR filters with each section having a scaling gain equal to 1/A.
Note
Coefficients and Gain
If you have a scaling gain separate from the coefficient values, you can enter it
in Filter Analyzer using the Import Filters dialog box. At the command
line, you can specify the coefficients and gain as a cell array of the form {B,A,g}
, where B and A are as
defined in the Filter Coefficients section.
The gain can be a scalar overall gain or a vector of section gains.
If the gain is a scalar, Filter Analyzer applies the value uniformly to all the cascade filter sections.
If the gain is a vector, it must have one more element than the number of filter sections in the cascade. Filter Analyzer applies a scale value to each of the filter sections and applies the last value uniformly to all the filter sections.
If you specify the coefficient matrices and gain vector as
Filter Analyzer uses the transfer function
digitalFilter
Objects
You can use Filter Analyzer to analyze digitalFilter
objects. Use designfilt
to generate or edit digital filters based on
frequency-response specifications.
Filter System Objects
If you have DSP System Toolbox™, you can use Filter Analyzer to analyze these filter System objects.
System object |
---|
dsp.AllpassFilter |
dsp.AllpoleFilter |
dsp.CICCompensationDecimator |
dsp.CICCompensationInterpolator |
dsp.CICDecimator |
dsp.CICInterpolator |
|
dsp.CoupledAllpassFilter |
|
dsp.Delay |
dsp.Differentiator |
dsp.DigitalDownConverter |
dsp.DigitalUpConverter |
dsp.FIRDecimator |
dsp.FIRFilter |
dsp.FIRHalfbandDecimator |
dsp.FIRHalfbandInterpolator |
dsp.FIRInterpolator |
dsp.FIRRateConverter |
dsp.FarrowRateConverter |
dsp.FilterCascade |
dsp.FourthOrderSectionFilter — Filter
Analyzer does not support fixed-point arithmetic for
this object |
dsp.HighpassFilter |
dsp.IIRFilter |
dsp.IIRHalfbandDecimator |
dsp.IIRHalfbandInterpolator |
dsp.LowpassFilter |
dsp.NotchPeakFilter
— Filter Analyzer does not support fixed-point
arithmetic for this System object |
dsp.ParallelFilter |
dsp.SOSFilter |
dsp.VariableBandwidthFIRFilter |
dsp.VariableBandwidthIIRFilter |
If you also have DSP HDL Toolbox™, you can use Filter Analyzer to analyze these filter System objects.
System object |
---|
|
|
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| cell
Complex Number Support: Yes
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.
Example: FilterNames=["LP" "HP"],SampleRates=[150
3e3]
Arithmetic
— Arithmetic type of filter System objects
"double"
(default) | "single"
| "fixed"
Arithmetic type of filter System objects, specified as one of
"double"
, "single"
, or
"fixed"
. If you do not specify this argument, and the filter
System objects are in an unlocked state, Filter Analyzer assumes the filters
are double precision.
Data Types: char
| string
FilterNames
— Names of filters to replace
string vector
Names of filters to replace, specified as a string vector. Filter names are the names that identify the different filters in the app Filters table.
Example: ["LPbutter" "LPelliptic"]
Data Types: char
| string
SampleRates
— Filter sample rates
1
(default) | scalar | vector
Filter sample rates, specified as a scalar or vector of values specified in Hz.
If
SampleRates
is a scalar, the specified value applies to all filters.If
SampleRates
is a vector, it must have a number of elements equal to the number of filters.
This argument does not apply if one or more filters are objects with a sample rate.
Example: [150 3e3]
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Version History
Introduced in R2024a
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
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)