| Filter Design Toolbox™ | ![]() |
d = fdesign.decimator(m)
d = fdesign.decimator(m,design)
d = fdesign.decimator(m,design,spec)
d = fdesign.decimator(...,spec,specvalue1,specvalue2,...)
d = fdesign.decimator(...,fs)
d = fdesign.decimator(...,magunits)
d = fdesign.decimator(m) constructs a decimating filter specification object d, applying default values for the properties fp, fst, ap, and ast and using the default design, Nyquist. Specify m, the decimation factor, as an integer. When you omit the input argument m, fdesign.decimator sets the decimation factor m to 2.
Using fdesign.decimator with a design method generates an mfilt object.
d = fdesign.decimator(m,design) constructs a decimator with the decimation factor m and the design type you specify in design. By using the design input argument, you can choose the sort of filter that results from using the decimator specifications object. design accepts the following strings that define the filter response.
design String | Description |
|---|---|
arbmag | Sets the design for the decimator specifications object to Arbitrary Magnitude. |
arbmagnphase | Sets the design for the decimator specifications object to Arbitrary Magnitude and Phase. |
bandpass | Sets the design for the decimator specifications object to bandpass. |
bandstop | Sets the design for the decimator specifications object to bandstop. |
cic | Sets the design for the decimator specifications object to CIC filter. |
ciccomp | Sets the design for the decimator specifications object to CIC compensator. |
halfband | Sets the design for the decimator specifications object to halfband. |
highpass | Sets the design for the decimator specifications object to highpass. |
isinclp | Sets the design for the decimator specifications object to inverse-sinc lowpass. |
lowpass | Sets the design for the decimator specifications object to lowpass. |
nyquist | Sets the design for the decimator specifications object to Nyquist. |
Notice the entries in the first column. They match the design method names. However, when you create your specifications object, the Response property contains the full name of the response, such as CIC Compensator or Inverse-Sinc Lowpass, rather than the shorter method names isinclp or ciccomp. So, when designing a new filter object, use the design String name shown in the left column of the table. To change the Response property value for an existing specifications object, use the full response name.
d = fdesign.decimator(m,design,spec) constructs object d and sets its Specification property to spec. Entries in the spec string represent various filter response features, such as the filter order, that govern the filter design. Valid entries for spec depend on the design type of the specifications object.
When you add the spec input argument, you must also add the design input argument.
Because you are designing multirate filters, the specification strings available are not the same as the specifications for designing single-rate filters with such design methods as fdesign.lowpass. The strings are not case sensitive.
The decimation factor m is not in the specification strings. Various design types provide different specifications, as shown in this table.
Design Type | Valid Specification Strings |
|---|---|
Arbitrary Magnitude |
|
Arbitrary Magnitude and Phase |
|
Bandpass |
|
Bandstop |
|
CIC |
|
CIC Compensator |
|
Halfband |
|
Highpass |
|
Inverse-Sinc Lowpass |
|
Lowpass |
|
Nyquist |
|
The string entries are defined as follows:
a — amplitude vector. Values in a define the filter amplitude at frequency points you specify in f, the frequency vector. If you use a, you must use f as well. Amplitude values must be real.
ap — amount of ripple allowed in the pass band in decibels (the default units). Also called Apass.
ap1 — amount of ripple allowed in the pass band in decibels (the default units). Also called Apass1. Bandpass and bandstop filters use this option.
ap2 — amount of ripple allowed in the pass band in decibels (the default units). Also called Apass2. Bandpass and bandstop filters use this option.
ast — attenuation in the first stop band in decibels (the default units). Also called Astop.
ast1 — attenuation in the first stop band in decibels (the default units). Also called Astop1. Bandpass and bandstop filters use this option.
ast2 — attenuation in the first stop band in decibels (the default units). Also called Astop2. Bandpass and bandstop filters use this option.
b — number of bands in the multiband filter
f — frequency vector. Frequency values in f specify locations where you provide specific filter response amplitudes. When you provide f you must also provide a.
fc1 — cutoff frequency for the point 3 dB point below the passband value for the first cutoff. Specified in normalized frequency units. Bandpass and bandstop filters use this option.
fc2 — cutoff frequency for the point 3 dB point below the passband value for the second cutoff. Specified in normalized frequency units. Bandpass and bandstop filters use this option.
fp1 — frequency at the start of the pass band. Specified in normalized frequency units. Also called Fpass1. Bandpass and bandstop filters use this option.
fp2 — frequency at the end of the pass band. Specified in normalized frequency units. Also called Fpass2. Bandpass and bandstop filters use this option.
fst1 — frequency at the end of the first stop band. Specified in normalized frequency units. Also called Fstop1. Bandpass and bandstop filters use this option.
fst2 — frequency at the start of the second stop band. Specified in normalized frequency units. Also called Fstop2. Bandpass and bandstop filters use this option.
h — complex frequency response values
n — filter order.
tw — width of the transition region between the pass and stop bands. Both halfband and Nyquist filters use this option.
d = fdesign.decimator(...,spec,specvalue1,specvalue2,...) constructs an object d and sets its specifications at construction time.
d = fdesign.decimator(...,fs) adds the argument fs, specified in Hz, to define the sampling frequency to use. In this case, all frequencies in the specifications are in Hz as well.
d = fdesign.decimator(...,magunits) specifies the units for any magnitude specification you provide in the input arguments. magunits can be one of
linear — specify the magnitude in linear units.
dB — specify the magnitude in dB (decibels).
squared — specify the magnitude in power units.
When you omit the magunits argument, fdesign assumes that all magnitudes are in decibels. Note that fdesign stores all magnitude specifications in decibels (converting to decibels when necessary) regardless of how you specify the magnitudes.
These examples show how to construct decimating filter specification objects. First, create a default specifications object without using input arguments except for the decimation factor m.
d = fdesign.decimator(2,'nyquist',2,0.1,80) % Set tw=0.1, and ast=80.
d =
MultirateType: 'Decimator'
Response: 'Nyquist'
DecimationFactor: 2
Specification: 'TW,Ast'
Description: {'Transition Width';
'Stopband Attenuation (decibels)'}
NormalizedFrequency: true
TransitionWidth: 0.1
Astop: 80 Now create an object by passing a specification type string 'fst1,fp1,fp2,fst2,ast1,ap,ast2' and a design — the resulting object uses default values for the filter specifications. You must provide the design input argument, bandpass in this example, when you include a specification.
d=fdesign.decimator(8,'bandpass','fst1,fp1,fp2,fst2,...
ast1,ap,ast2')
d =
MultirateType: 'Decimator'
Response: 'Bandpass'
DecimationFactor: 8
Specification: 'Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2'
Description: {7x1 cell}
NormalizedFrequency: true
Fstop1: 0.35
Fpass1: 0.45
Fpass2: 0.55
Fstop2: 0.65
Astop1: 60
Apass: 1
Astop2: 60 Create another decimating filter specification object, passing the specification values to the object rather than accepting the default values for fp,fst,ap,ast.
d=fdesign.decimator(3,'lowpass',.45,0.55,.1,60)
d =
MultirateType: 'Decimator'
Response: 'Lowpass'
DecimationFactor: 3
Specification: 'Fp,Fst,Ap,Ast'
Description: {4x1 cell}
NormalizedFrequency: true
Fpass: 0.45
Fstop: 0.55
Apass: 0.1
Astop: 60 Now pass the filter specifications that correspond to the specifications — n,fc,ap,ast.
d=fdesign.decimator(3,'ciccomp',1,2,'n,fc,ap,ast',...
20,0.45,.05,50)
d =
MultirateType: 'Decimator'
Response: 'CIC Compensator'
DecimationFactor: 3
Specification: 'N,Fc,Ap,Ast'
Description: {4x1 cell}
NumberOfSections: 2
DifferentialDelay: 1
NormalizedFrequency: true
FilterOrder: 20
Fcutoff: 0.45
Apass: 0.05
Astop: 50 Now design a decimator using the kaiserwin design method.
hm = kaiserwin(d)
Pass a new specification type for the filter, specifying the filter order. Note that the inputs must include the differential delay dd with the CIC input argument to design a CIC specification object.
m = 5;
dd = 2;
d = fdesign.decimator(m,'cic',dd,'fp,ast',0.55,55)
d =
MultirateType: 'Decimator'
Response: 'CIC'
DecimationFactor: 5
Specification: 'Fp,Ast'
Description: {'Passband Frequency';'
Stopband Attenuation(decibels)'}
DifferentialDelay: 2
NormalizedFrequency: true
Fpass: 0.55 In this example, you specify a sampling frequency as the last input argument. Here is it 1000 Hz.
d=fdesign.decimator(8,'bandpass','fst1,fp1,fp2,fst2,...
ast1,ap,ast2',0.25,0.35,.55,.65,50,.05,50,1e3)
d =
MultirateType: 'Decimator'
Response: 'Bandpass'
DecimationFactor: 8
Specification: 'Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2'
Description: {7x1 cell}
NormalizedFrequency: false
Fs: 1000
Fstop1: 0.25
Fpass1: 0.35
Fpass2: 0.55
Fstop2: 0.65
Astop1: 50
Apass: 0.05
Astop2: 50 In this, the last example, use the linear option for the filter specification object and specify the stopband ripple attenuation in linear format.
hs = fdesign.decimator(4,'lowpass','n,fst,ap,ast',15,0.55,.05,50,...
1e-3,'linear') % 1e-3 = 60decibels.
hs =
Response: 'Lowpass decimator'
Specification: 'TW,Ast'
Description: {'Transition Width';'
Stopband Attenuation (decibels)'}
DecimationFactor: 4
NormalizedFrequency: false
Fs: 500
TransitionWidth: 0.1
Astop: 60 Design the filter and display the magnitude response in FVTool.
designmethods(hs); equiripple(hs); % Starts FVTool to display the response.

fdesign, fdesign.arbmag, fdesign.arbmagnphase, fdesign.interpolator, fdesign.rsrc
![]() | fdesign.ciccomp | fdesign.differentiator | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |