fdesign.decimator - Decimator filter specification object

Syntax

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)

Description

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

  • n,f,a (default string)

  • n,b,f,a

Arbitrary Magnitude and Phase

  • n,f,h (default string)

  • n,b,f,h

Bandpass

  • fst1,fp1,fp2,fst2,ast1,ap,ast2 (default string)

  • n,fc1,fc2

  • n,fst1,fp1,fp2,fst2

Bandstop

  • n,fc1,fc2

  • n,fp1,fst1,fst2,fp2

  • fp1,fst1,fst2,fp2,ap1,ast,ap2 (default string)

CIC

  • fp,ast (default and only string)

CIC Compensator

  • fp,fst,ap,ast (default string)

  • n,fc,ap,ast

  • n,fp,ap,ast

  • n,fp,fst

  • n,fst,ap,ast

Halfband

  • tw,ast (default string)

  • n,tw

  • n

  • n,ast

Highpass

  • fst,fp,ast,ap (default string)

  • n,fc

  • n,fc,ast,ap

  • n,fp,ast,ap

  • n,fst,fp,ap

  • n,fst,fp,ast

  • n,fst,ast,ap

  • n,fst,fp

Inverse-Sinc Lowpass

  • fp,fst,ap,ast (default string)

  • n,fc,ap,ast

  • n,fst,ap,ast

  • n,fp,ap,ast

  • n,fp,fst

Lowpass

  • fp,fst,ap,ast (default string)

  • 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

  • tw,ast (default string)

  • n,tw

  • n

  • n,ast

The string entries are defined as follows:

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

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

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.

See Also

fdesign, fdesign.arbmag, fdesign.arbmagnphase, fdesign.interpolator, fdesign.rsrc

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS