| Filter Design Toolbox™ | ![]() |
setspecs(d,specvalue1,specvalue2,...)
setspecs(d,Specification,specvalue1,specvalue2,...)
setspecs(...fs)
setspecs(...,inputunits)
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:
linear — to indicate that your input specification values represent linear units, such as decimal values for the filter feature locations when you select normalized sampling frequency.
squared — indicating that your input specification values represent squared magnitude values, usually decibels. This is the default value. When you omit the inputunits argument, setspecs assumes all specification values are in square magnitude form.
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.
To demonstrate using setspecs, the following examples show how to use various syntax forms to set the values in filter specifications objects.
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.4000Now 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: 4This 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.0206Finally, 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: 70designmethods, fdesign.bandpass, fdesign.bandstop, fdesign.decimator, fdesign.halfband, fdesign.highpass, fdesign.interpolator, fdesign.lowpass, fdesign.nyquist, fdesign.rsrc
![]() | set2int | sos | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |