Products & Services Industries Academia Support User Community Company

Learn more about Filter Design Toolbox   

scale - Scale sections of SOS filter

Syntax

scale(hd)
scale(hd,pnorm)
scale(hd,pnorm,p1,v1,p2,v2,...)
scale(hd,pnorm,opts)

Description

scale(hd) scales the second-order section filter hd using peak magnitude response scaling (L-infinity, Linf), to reduce the possibility of overflows when your filter hd operates in fixed-point arithmetic mode.

scale(hd,pnorm) specifies the norm used to scale the filter. pnorm can be either a discrete-time-domain norm or a frequency-domain norm.

Valid time-domain norm values for pnorm are l1, l2, and linf. Valid frequency-domain norm values are L1, L2, and Linf. Note that L2 norm is equal to l2 norm (by Parseval's theorem) but this is not true for other norms — l1 is not the same as L1 and Linf is not the same as linf.

Filter norms can be ordered in terms of how stringent they are, as follows from most stringent to least:

l1 >= Linf >= L2 = l2 >= L1 >= linf

Using l1, the most stringent scaling, produces a filter that is least likely to overflow, but has the worst signal-to-noise ratio performance. Linf scaling, the least stringent, and the default scaling, is the most commonly used scaling norm.

scale(hd,pnorm,p1,v1,p2,v2,...) uses parameter name/parameter value pair input arguments to specify optional scaling parameters. Valid parameter names and options values appear in the table.

Parameter

Default

Description and Valid Value

MaxNumerator

2

Maximum allowed value for numerator coefficients.

MaxScaleValue

Not Used

Maximum allowed scale values. The filter applies the MaxScaleValue limit only when you set ScaleValueConstraint to a value other than unit (the default setting). Setting MaxScaleValue to any numerical value automatically changes the ScaleValueConstraint setting to none.

NumeratorConstraint

none

Specifies whether and how to constrain numerator coefficient values. Options are none, normalize, po2, and unit

OverflowMode

wrap

Sets the way the filter handles arithmetic overflow situations during scaling. Choose from wrap, saturate or satall.

ScaleValueConstraint

unit

Specify whether to constrain the filter scale values, and how to constrain them. Valid options are none, po2, and unit. Choosing unit for the constraint disables the MaxScaleValue property setting. po2 constrains the scale values to be powers of 2, while none removes any constraint on the scale values.

sosReorder

auto

Reorder filter sections prior to applying scaling. Select one of auto, none, up, or down.

If your device does not have guard bits available and you are using saturation arithmetic for filtering, use the satall setting for OverFlowMode instead of saturate.

With the Arithmetic property of hd set to double or single, the filter uses the default values for all options that you do not specify explicitly. When you set Arithmetic to fixed, the values used for the scaling options are set according to the settings in filter hd. However, if you specify a scaling option different from the settings in hd, the filter uses your explicit option selection for scaling purposes, but does not change the property setting in hd.

scale(hd,pnorm,opts) uses an input scale options object opts to specify the optional scaling parameters in lieu of specifying parameter-value pairs. You can create the opts object using

opts = scaleopts(hd)

For more information about scaling objects, refer to scaleopts in the Help system.

Examples

Demonstrate the Linf-norm scaling of a lowpass elliptic filter with second-order sections. Start by creating a lowpass elliptical filter in zero, pole, gain (z,p,k) form.

[z,p,k] = ellip(5,1,50,.3);
[sos,g] = zp2sos(z,p,k);
hd = dfilt.df2sos(sos,g);
scale(hd,'linf','scalevalueconstraint','none','maxscalevalue',2)

See Also

cumsec, norm, reorder, scalecheck, scaleopts

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

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