fdesign.decimator - Decimator filter specification object - MATLAB (original) (raw)

Decimator filter specification object

Note

Support for designing an mfilt.firdecim object using the fdesign.decimator and the design functions will be removed in a future release. Use thedesign function with theSystemObject=true flag to design an FIR decimator System object™.

Note

Support for multistage filter design using the fdesign.decimator object will be removed in a future release. Use the designMultistageDecimator function instead.

For more information, see Version History.

Syntax

decimSpecs = fdesign.decimator(M) decimSpecs = fdesign.decimator(M, RESPONSE) decimSpecs = fdesign.decimator(M, CICRESPONSE, D) decimSpecs = fdesign.decimator(M, RESPONSE, SPEC) decimSpecs = fdesign.decimator(...,SPEC,specvalue1,specvalue2,...) decimSpecs = fdesign.decimator(...,Fs) decimSpecs = fdesign.decimator(...,MAGUNITS)

Description

decimSpecs = fdesign.decimator(M) constructs a decimator filter specification object decimSpecs with theDecimationFactor property equal to the positive integer M and the Response property set to 'Nyquist'. The default values for the transition width and stopband attenuation in the Nyquist design are 0.1π radians/sample and 80 dB. If M is unspecified, M defaults to 2.

decimSpecs = fdesign.decimator(M, RESPONSE) constructs a decimator specification object with the decimation factor M and the 'Response' property.

decimSpecs = fdesign.decimator(M, CICRESPONSE, D) constructs a CIC or CIC compensator decimator specification object with the decimation factor,M, 'Response' property equal to 'CIC' or 'CICCOMP', and D equal to the differential delay. The differential delay D must precede any specification option.

Because you are designing multirate filters, the specification options available are not the same as the specifications for designing single-rate filters. The decimation factor M is not included in the specification options. Different filter responses support different specifications. The following table lists the supported response types and specification options. The options are not case sensitive.

Design Method Valid Specification Options
'Arbitrary Magnitude' See fdesign.arbmag for a description of the specification entries. 'N,F,A' (default option)'N,B,F,A'
'Arbitrary Magnitude and Phase' See fdesign.arbmagnphase for a description of the specification entries. 'N,F,H' (default option)'N,B,F,H'
'Bandpass' See fdesign.bandpass for a description of the specification entries. 'Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2' (default option)'N,Fc1,Fc2''N,Fst1,Fp1,Fp2,Fst2'
'Bandstop' See fdesign.bandstop for a description of the specification entries. 'N,Fc1,Fc2''N,Fp1,Fst1,Fst2,Fp2''Fp1,Fst1,Fst2,Fp2,Ap1,Ast,Ap2' (default option)
'CIC' 'Fp,Ast' — Only valid specification. Fp is the passband frequency and Ast is the stopband attenuation in decibels.To specify a CIC decimator, include the differential delay after 'CIC' and before the filter specification option: 'Fp,Ast'. For example: d = fdesign.decimator(2,'cic',4,'Fp,Ast',0.4,40);
'CIC Compensator' See fdesign.ciccomp for a description of the specification entries. 'Fp,Fst,Ap,Ast' (default option)'N,Fc,Ap,Ast''N,Fp,Ap,Ast''N,Fp,Fst''N,Fst,Ap,Ast'To specify a CIC compensator decimator, include the differential delay after 'CICCOMP' and before the filter specification. For example: d = fdesign.decimator(2,'ciccomp',4);
'Differentiator' 'N' — filter order
'Gaussian' 'Nsym,BT' — Nsym is the filter order in symbols and BT is the bandwidth-symbol time product.The specification must be preceded by an integer-valuedSamplesPerSymbol.
'Halfband' See fdesign.halfband for a description of the specification entries. 'TW,Ast' (default option)'N,TW''N''N,Ast'If you use the quasi-linear IIR design method, iirlinphase, with a halfband specification, the interpolation factor must be 2.
'Highpass' See fdesign.highpass for a description of the specification entries. 'Fst,Fp,Ast,Ap' (default option)'N,F3db''N,Fc''N,Fc,Ast,Ap''N,Fp,Ast,Ap''N,Fst,Ast,Ap''N,Fst,Fp''N,Fst,Ast,Ap''N,Fst,Fp,Ast'
'Hilbert' See fdesign.hilbert for a description of the specification entries. 'N,TW' (default option)'TW,Ap'
'Inverse-sinc Lowpass' See fdesign.isinclp for a description of the specification entries. 'Fp,Fst,Ap,Ast' (default option) 'N,Fc,Ap,Ast''N,Fp,Fst''N,Fst,Ap,Ast'
'Inverse-sinc Highpass' See fdesign.isinchp for a description of the specification entries. 'Fst,Fp,Ast,Ap' (default option) 'N,Fc,Ast,Ap''N,Fst,Fp''N,Fst,Ast,Ap'
'Lowpass' See fdesign.lowpass for a description of the specification entries. 'Fp,Fst,Ap,Ast' (default option)'N,F3dB''N,Fc''N,Fc,Ap,Ast''N,Fp,Ap,Ast''N,Fp,Fst''N,Fp,Fst,Ap''N,Fp,Fst,Ast''N,Fst,Ap,Ast'
'Nyquist' See fdesign.nyquist for a description of the specification entries. For all Nyquist specifications, you must specify the _L_th band. This typically corresponds to the DecimationFactor. 'TW,Ast' (default option)'N''N,Ast''N,Ast'

decimSpecs = fdesign.decimator(M, RESPONSE, SPEC) constructs object decimSpecs and sets the Specification property to SPEC for the response type, RESPONSE. Entries in the SPEC represent various filter response features, such as the filter order, that govern the filter design. Valid entries for SPEC depend on theRESPONSE type.

Because you are designing multirate filters, the specification options available are not the same as the specifications for designing single-rate filters with such response types as fdesign.lowpass. The options are not case sensitive.

The decimation factor M is not in the specification options.

decimSpecs = fdesign.decimator(...,SPEC,specvalue1,specvalue2,...) constructs an object decimSpecs and sets its specifications at construction time.

decimSpecs = fdesign.decimator(...,Fs) provides the sampling frequency of the signal to be filtered. Fs must be specified as a scalar trailing the other numerical values provided. Fs is assumed to be in Hz as are all other frequency values provided.

decimSpecs = fdesign.decimator(...,MAGUNITS) specifies the units for any magnitude specification you provide in the input arguments.MAGUNITS can be one of

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.

Examples

collapse all

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) %#ok % Set tw=0.1, and ast=80.

d = decimator with properties:

      MultirateType: 'Decimator'
           Response: 'Nyquist'
   DecimationFactor: 2
      Specification: 'TW,Ast'
        Description: {2×1 cell}
               Band: 2
NormalizedFrequency: 1
    TransitionWidth: 0.1000
              Astop: 80

Now create an object by passing a specification type option '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'); %#ok

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); %#ok

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);

Now design a decimator using the equiripple design method.

equiDecimator = design(d,'equiripple',SystemObject=true);

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); %#ok

In this example, you specify a sampling frequency as the last input argument. Here is it 1000 Hz. Design an equiripple filter and plot the magnitude response:

d = fdesign.decimator(8,'bandpass','fst1,fp1,fp2,fst2,ast1,ap,ast2',... 100,150,250,300,50,.05,50,1000); filterAnalyzer(design(d,'equiripple',SystemObject=true))

Version History

Introduced in R2011a

expand all

Support for multistage filter design using the fdesign.decimator object will be removed in a future release. Use the designMultistageDecimator function instead.

Update Code

This table shows how to update your code.

Discouraged Usage Recommended Replacement
Using the design function and passing the'multistage' flag as an input.D = 9; % Decimation factor TW = 2205; % Transition width Astop = 80; % Stopband attenuation Fs = 44100; % Input sample rate filtSpec = fdesign.decimator(D,'nyquist',D,TW,Astop,Fs) filtObj = design(filtSpec,'multistage',SystemObject=true) When you set the cost method to 'design', the function designs an optimal number of stages so that the overall cost of implementation is low.filtObj = designMultistageDecimator(D,Fs,TW,Astop,... CostMethod='design')
Using the multistage function directly.filtObj = multistage(filtSpec,SystemObject=true)

Support for designing an mfilt.firdecim object using the fdesign.decimator and the design functions will be removed in a future release.

To design an FIR decimator using the fdesign.decimator filter specification object, use the design function with theSystemObject=true flag. Setting this flag totrue ensures that the output object is a filter System object instead of an mfilt.firdecim object.

fdesignObj = fdesign.decimator; FIRDecimObj = design(fdesignObj,SystemObject=true)

FIRDecimObj =

dsp.FIRDecimator with properties:

DecimationFactor: 2
 NumeratorSource: 'Property'
       Numerator: [-1.5162e-05 0 4.1707e-05 0 … ]
       Structure: 'Direct form'

Show all properties