setspecs - Specifications for filter specification object

Syntax

setspecs(d,specvalue1,specvalue2,...)
setspecs(d,Specification,specvalue1,specvalue2,...)
setspecs(...fs)
setspecs(...,inputunits)

Description

setspecs(d,specvalue1,specvalue2,...) sets the specifications in the order that they appear in the Specification property for the design object d.

setspecs(d,Specification,specvalue1,specvalue2,...) lets you change the specifications for the object and set values for the new specifiers. When you already have a filter specifications object, this syntax lets you change the Specification string and the associated specification values for the object, rather than recreating the object to change it.

setspecs(...fs) sets the fs. If you choose to specify the fs, it must be immediately after you provide all of the specifications for the current Specification. Refer to Examples to see this being used.

setspecs(...,inputunits) specifies the inputunits option allows you to specify your filter magnitude specification values in different units. inputunits can be either of these strings:

You are not required to provide fs, the sampling frequency, as an input when you use the inputunits option. As you see from the syntax options, the inputunits option must be the rightmost input argument in the syntax — inputunits must be passed as the final input.

Examples

To demonstrate using setspecs, the following examples show how to use various syntax forms to set the values in filter specifications objects.

Example 1

Create a lowpass design object d using filter order and a cutoff value for the location of the edge of the passband. Then change the cutoff and order specifications of d.

d = fdesign.lowpass('n,fc')
 
d =
 
           ResponseType: 'Lowpass with cutoff'
          Specification: 'N,Fc'
            Description: {2x1 cell}
    NormalizedFrequency: true
                     Fs: 'Normalized'
            FilterOrder: 10
                Fcutoff: 0.5000

setspecs(d, 20, .4);
 
d =
 
           ResponseType: 'Lowpass with cutoff'
          Specification: 'N,Fc'
            Description: {2x1 cell}
    NormalizedFrequency: true
                     Fs: 'Normalized'
            FilterOrder: 20
                Fcutoff: 0.4000

Example 2

Now specify a sampling frequency after you make d.

d = fdesign.lowpass('n,fc')
 
d =
 
           ResponseType: 'Lowpass with cutoff'
          Specification: 'N,Fc'
            Description: {2x1 cell}
    NormalizedFrequency: true
                     Fs: 'Normalized'
            FilterOrder: 10
                Fcutoff: 0.5000


setspecs(d, 20, 4, 20);
d
 
d =
 
           ResponseType: 'Lowpass with cutoff'
          Specification: 'N,Fc'
            Description: {2x1 cell}
    NormalizedFrequency: false
                     Fs: 20
            FilterOrder: 20
                Fcutoff: 4

Example 3

This example uses the inputunits argument to change from the default setting of square to linear unit. Start with the default lowpass design object that specifies the edge locations for the passband and stopband, and the desired attenuation in the passbands and stopbands.

d=fdesign.lowpass
 
d =
 
           ResponseType: 'Minimum-order lowpass'
          Specification: 'Fp,Fst,Ap,Ast'
            Description: {4x1 cell}
    NormalizedFrequency: true
                     Fs: 'Normalized'
                  Fpass: 0.4500
                  Fstop: 0.5500
                  Apass: 1
                  Astop: 60 

Convert to linear input values and reset the filter spec for d at the same time. With the linear argument included, the inputs for the response features now need to be in linear units.

setspecs(d,.4,.5,.1,.05,'linear')
d
 
d =
 
           ResponseType: 'Minimum-order lowpass'
          Specification: 'Fp,Fst,Ap,Ast'
            Description: {4x1 cell}
    NormalizedFrequency: true
                     Fs: 'Normalized'
                  Fpass: 0.4000
                  Fstop: 0.5000
                  Apass: 1.7430
                  Astop: 26.0206

Example 4

Finally, use setspecs to change the Specification string and apply new filter specifications to d.

d=fdesign.decim(3)
 
d =
 
           ResponseType: 'Minimum-order nyquist'
          Specification: 'TW,Ast'
            Description: {2x1 cell}
       DecimationFactor: 3
    NormalizedFrequency: true
                     Fs: 'Normalized'
        TransitionWidth: 0.1000
                  Astop: 80


setspecs(d,'n,ast',16,70)
d
 
d =
 
           ResponseType: 'Nyquist with filter order and stopband attenuation'
          Specification: 'N,Ast'
            Description: {2x1 cell}
       DecimationFactor: 3
    NormalizedFrequency: true
                     Fs: 'Normalized'
        PolyphaseLength: 16
                  Astop: 70

See Also

designmethods, fdesign.bandpass, fdesign.bandstop, fdesign.decimator, fdesign.halfband, fdesign.highpass, fdesign.interpolator, fdesign.lowpass, fdesign.nyquist, fdesign.rsrc

  


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