design
Apply design method to filter specification object
Syntax
Description
uses the filter specification object, filt
= design(designSpecs
,'Systemobject',true)designSpecs
, to generate a filter
System object™, filt
. When you do not provide a design method as an
input argument, design
uses the default design method. Use
designmethods(designSpecs,'default')
to see the default design method
for your filter design specification object. For more information on filter design
specifications, see Design a Filter in Fdesign — Process Overview.
uses the design method specified by filt
= design(designSpecs
,method
,'Systemobject',true)method
. method
must be one of the options returned by designmethods
.
specifies design method options. Use filt
= design(designSpecs
,method
,PARAM,VALUE,...,'Systemobject',true)designoptions(designSpecs,method)
to see a list of available design method options to choose from. For detailed help on each
of these options, type help(designSpecs,method)
in the MATLAB® command prompt.
specifies design method options using the structure filt
= design(designSpecs
,method
,opts
,'Systemobject',true)opts
.
opts
is usually obtained from the designopts
function and then specified as an input to the
design
function. Use help(designSpecs,method)
for more information on optional inputs.
Examples
Design FIR Equiripple Lowpass Filters
Design an FIR equiripple lowpass filter. Specify a passband edge frequency of 0.2π rad/sample and a stopband edge frequency of 0.25π rad/sample. Set the passband ripple to 0.5 dB and the stopband attenuation to 40 dB..
designSpecs = fdesign.lowpass('Fp,Fst,Ap,Ast',0.2,0.25,0.5,40)
designSpecs = lowpass with properties: Response: 'Lowpass' Specification: 'Fp,Fst,Ap,Ast' Description: {4x1 cell} NormalizedFrequency: 1 Fpass: 0.2000 Fstop: 0.2500 Apass: 0.5000 Astop: 40
Use the default Equiripple method to design the filter.
filt = design(designSpecs,'SystemObject',true)
filt = dsp.FIRFilter with properties: Structure: 'Direct form' NumeratorSource: 'Property' Numerator: [-0.0057 -0.0010 0.0010 0.0040 0.0065 0.0073 0.0055 0.0014 -0.0033 -0.0066 -0.0067 -0.0029 0.0033 0.0091 0.0114 0.0083 4.2874e-04 -0.0091 -0.0158 -0.0154 -0.0070 0.0069 0.0202 0.0259 0.0193 5.1049e-04 -0.0239 ... ] (1x69 double) InitialConditions: 0 Use get to show all properties
Determine the available design methods by running the designmethods
function on the filter design specification object, designSpecs
.
designmethods(designSpecs,'SystemObject',true)
Design Methods that support System objects for class fdesign.lowpass (Fp,Fst,Ap,Ast): butter cheby1 cheby2 ellip equiripple ifir kaiserwin multistage
You can also specify the design options used in designing the filter. To see a list of available options, run the designoptions
function on designSpecs
.
designoptions(designSpecs,'equiripple')
ans = struct with fields:
FilterStructure: {'dffir' 'dffirt' 'dfsymfir' 'fftfir'}
DensityFactor: 'double'
MinPhase: 'bool'
MaxPhase: 'bool'
MinOrder: {'any' 'even' 'odd'}
StopbandShape: {'flat' 'linear' '1/f'}
StopbandDecay: 'double'
UniformGrid: 'bool'
SystemObject: 'bool'
DefaultFilterStructure: 'dffir'
DefaultDensityFactor: 16
DefaultMaxPhase: 0
DefaultMinOrder: 'any'
DefaultMinPhase: 0
DefaultStopbandDecay: 0
DefaultStopbandShape: 'flat'
DefaultSystemObject: 0
DefaultUniformGrid: 1
Design a minimum-phase FIR equiripple filter by setting 'MinPhase'
to true
.
filtMin = design(designSpecs,'equiripple','MinPhase',true,'SystemObject',true)
filtMin = dsp.FIRFilter with properties: Structure: 'Direct form' NumeratorSource: 'Property' Numerator: [0.0163 0.0381 0.0724 0.1144 0.1562 0.1875 0.1981 0.1814 0.1378 0.0750 0.0071 -0.0498 -0.0824 -0.0845 -0.0593 -0.0181 0.0236 0.0514 0.0571 0.0411 0.0117 -0.0187 -0.0385 -0.0410 -0.0272 -0.0040 0.0182 0.0308 ... ] (1x59 double) InitialConditions: 0 Use get to show all properties
Display pole-zero plots of the default and minimum-phase designs.
filterAnalyzer(filt,filtMin,Analysis='polezero',... FilterNames=["DefaultDesign","MinimumPhaseDesign"]);
Redesign the filter using the elliptic method. Determine the available design options for the elliptic method.
designoptions(designSpecs,'ellip')
ans = struct with fields:
FilterStructure: {'df1sos' 'df2sos' 'df1tsos' 'df2tsos' 'cascadeallpass' 'cascadewdfallpass'}
SOSScaleNorm: 'ustring'
SOSScaleOpts: 'fdopts.sosscaling'
MatchExactly: {'passband' 'stopband' 'both'}
SystemObject: 'bool'
DefaultFilterStructure: 'df2sos'
DefaultMatchExactly: 'both'
DefaultSOSScaleNorm: ''
DefaultSOSScaleOpts: [1x1 fdopts.sosscaling]
DefaultSystemObject: 0
Match the passband exactly by setting 'MatchExactly'
to 'passband'
.
filt = design(designSpecs,'ellip','MatchExactly','passband','SystemObject',true)
filt = dsp.SOSFilter with properties: Structure: 'Direct form II' CoefficientSource: 'Property' Numerator: [3x3 double] Denominator: [3x3 double] HasScaleValues: true ScaleValues: [0.2868 0.1982 0.2819 1] Use get to show all properties
You can specify the Pth norm scaling on the second-order sections. Use L-infinity norm scaling in the time domain.
filtL = design(designSpecs,'ellip','MatchExactly','passband','SOSScaleNorm','linf', ... 'SystemObject',true)
filtL = dsp.SOSFilter with properties: Structure: 'Direct form II' CoefficientSource: 'Property' Numerator: [3x3 double] Denominator: [3x3 double] HasScaleValues: false Use get to show all properties
Display the frequency responses of the filters.
filterAnalyzer(filt,filtL,Analysis="magnitude",... FilterNames=["DefaultScaling","LInfinityNormScaling"]);
Input Arguments
designSpecs
— Filter design specification object
fdesign.response
object
response
fdesign
returns a filter design specification object. Every
filter design specification object has these properties.
Property Name | Default Value | Description |
---|---|---|
| Depends on the chosen type | Defines the type of filter to design, such as an interpolator or bandpass filter. This is a read-only value. |
| Depends on the chosen type | Defines the filter characteristics used to define the desired filter
performance, such as the cutoff frequency |
| Depends on the filter type you choose | Contains descriptions of the filter specifications used to define the object, and the filter specifications you use when you create a filter from the object. This is a read-only value. |
| Logical | Determines whether the filter calculation uses a normalized frequency
from 0 to 1, or the frequency band from 0 to Fs/2, the sampling frequency. Accepts either
|
In addition to these properties, filter design specification objects may have other properties as well, depending on whether they design single-rate filters or multirate filters.
Added Properties for Multirate Filters | Description |
---|---|
| Specifies the amount to decrease the sampling rate. Always a positive integer. |
| Specifies the amount to increase the sampling rate. Always a positive integer. |
| Polyphase length is the length of each polyphase subfilter that
composes the decimator or interpolator or rate-change factor filters. Total
filter length is the product of |
method
— Design method
character vector
Design method, specified as a character vector. The design method you provide as the input argument must be one of the methods returned by:
designmethods(designSpecs,'Systemobject',true)
The table lists all the design methods. A subset of these become available depending
on the filter design specification object, designSpecs
.
Design methods | Description |
---|---|
| Butterworth filter |
| Chebyshev Type I filter |
| Chebyshev Type II filter |
| Elliptic filter |
| Equiripple FIR filter |
| Least-square linear-phase FIR filter |
|
Frequency-sampled FIR filter |
| Interpolated FIR filter |
| Quasi-linear phase IIR filter |
| Least P-norm optimal IIR filter |
| Least-squares IIR filter |
| FIR constrained least squares filter |
| Kaiser window filter |
| Maxflat FIR filter |
| Multistage filter |
| FIR filter using windowed impulse response |
To help you design filters more quickly, the input argument
method
accepts a variety of special keywords that force
design
to behave in different ways. This table presents the
keywords you can use for method
and how design
responds to the keyword:
Design Method Keyword | Description of the Design Response |
---|---|
| Forces |
| Forces |
| Produces filters from every applicable FIR design method for the
specifications in |
| Produces filters from every applicable IIR design method for the
specifications in |
| Designs filters using all applicable design methods for the
specifications object |
Keywords are not case sensitive.
When design
returns multiple filters in the output object, use
indexing to see the individual filters. For example, to see the third filter in
filt
,
enter:
filt(3)
Example: filt =
design(designSpecs,'butter','SystemObject',true)
Example: filt =
design(designSpecs,'ALLFIR','SystemObject',true)
opts
— Specify design options
structure
Specify design options by passing opts
structure as an input to
the design
function. The opts
structure is
obtained by running designopts(designSpecs,method)
.
designSpecs = fdesign.notch opts = designopts(designSpecs,'butter') opts.FilterStructure = 'df1sos' filt = design(designSpecs,'butter',opts,'SystemObject',true)
Version History
Introduced in R2009a
See Also
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 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)