fdesign.halfband - Halfband filter specification object

Syntax

d = fdesign.halfband
d = fdesign.halfband('type',type)
d = fdesign.halfband(spec)
d = fdesign.halfband(spec,specvalue1,specvalue2,...)
d = fdesign.halfband(specvalue1,specvalue2)
d = fdesign.halfband(...,fs)
d = fdesign.halfband(...,magunits)

Description

d = fdesign.halfband constructs a halfband filter specification object d, applying default values for the properties tw and ast.

Using fdesign.halfband with a design method generates a dfilt object.

d = fdesign.halfband('type',type) initializes the filter designer 'Type' property with type. "type" must be either lowpass or highpass and is not case sensitive.

d = fdesign.halfband(spec) constructs object d and sets its 'Specification' 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 are shown below. The strings are not case sensitive.

The string entries are defined as follows:

By default, all frequency specifications are assumed to be in normalized frequency units. Moreover, all magnitude specifications are assumed to be in dB. Different specification types may have different design methods available.

The filter design methods that apply to a halfband filter specification object change depending on the Specification string. Use designmethods to determine which design method applies to an object and its specification string.

d = fdesign.halfband(spec,specvalue1,specvalue2,...) constructs an object d and sets its specifications at construction time.

d = fdesign.halfband(specvalue1,specvalue2) constructs an object d assuming the default Specification property string tw,ast, using the values you provide for the input arguments specvalue1 and specvalue2 for tw and ast.

d = fdesign.halfband(...,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.halfband(...,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 a halfband filter specification object. First, create a default specifications object without using input arguments.

>> d=fdesign.halfband
 
d =
 
               Response: 'Halfband'                                      
          Specification: 'TW,Ast'                                        
            Description: {'Transition Width';'Stopband Attenuation (dB)'}
                   Type: 'Lowpass'                                       
    NormalizedFrequency: true                                            
        TransitionWidth: 0.1                                             
                  Astop: 80

Now create an object by passing a specification type string 'n,ast' — the resulting object uses default values for n and ast.

>> d=fdesign.halfband('n,ast')
 
d =
 
               Response: 'Halfband'                                  
          Specification: 'N,Ast'                                     
            Description: {'Filter Order';'Stopband Attenuation (dB)'}
                   Type: 'Lowpass'                                   
    NormalizedFrequency: true                                        
            FilterOrder: 10                                          
                  Astop: 80

Create another halfband filter object, passing the specification values to the object rather than accepting the default values for n and ast.

>> d = fdesign.halfband('n,ast', 42, 80)
 
d =
 
               Response: 'Halfband'                                  
          Specification: 'N,Ast'                                     
            Description: {'Filter Order';'Stopband Attenuation (dB)'}
                   Type: 'Lowpass'                                   
    NormalizedFrequency: true                                        
            FilterOrder: 42                                          
                  Astop: 80

For another example, pass the filter values that correspond to the default Specificationn,ast.

>> d = fdesign.halfband(.01, 80)
 
d =
 
               Response: 'Halfband'                                      
          Specification: 'TW,Ast'                                        
            Description: {'Transition Width';'Stopband Attenuation (dB)'}
                   Type: 'Lowpass'                                       
    NormalizedFrequency: true                                            
        TransitionWidth: 0.01                                            
                  Astop: 80 

This example designs an equiripple FIR filter, starting by passing a new specification type and specification values to fdesign.halfband.

>> hs = fdesign.halfband('n,ast',80,70)
 
hs =
 
               Response: 'Halfband'                                  
          Specification: 'N,Ast'                                     
            Description: {'Filter Order';'Stopband Attenuation (dB)'}
                   Type: 'Lowpass'                                   
    NormalizedFrequency: true                                        
            FilterOrder: 80                                          
                  Astop: 70

equiripple(hs); % Opens FVTool automatically.

In this example, pass the specifications for the filter, and then design a least-squares FIR filter from the object, using firls as the design method.

>> hs = fdesign.halfband('n,tw', 42, .04)
 
hs =
 
               Response: 'Halfband'                         
          Specification: 'N,TW'                             
            Description: {'Filter Order';'Transition Width'}
                   Type: 'Lowpass'                          
    NormalizedFrequency: true                               
            FilterOrder: 42                                 
        TransitionWidth: 0.04

>> designmethods(hs)


Design Methods for class fdesign.halfband (N,TW):


ellip
iirlinphase
equiripple
firls
kaiserwin

>> hd=firls(hs)
 
hd =
 
     FilterStructure: 'Direct-Form FIR'
          Arithmetic: 'double'         
           Numerator: [1x43 double]    
    PersistentMemory: false

In this example we design a 80th order equiripple halfband highpass filter with 70dB of stopband attenuation.

 d = fdesign.halfband('Type','Highpass','N,Ast',80,70);
    Hd = design(d,'equiripple');

See Also

fdesign, fdesign.decimator, design, fdesign.interpolator, fdesign.nyquist, setspecs

  


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