scale

Scale sections of SOS filter

Syntax

scale(hd)
scale(hd,pnorm)
scale(hd,pnorm,Name,Value)
scale(hd,pnorm,opts)
scale(hs)

Description

scale(hd) scales the second-order section filter hd using peak magnitude response scaling (L-infinity, 'Linf'). This scaling reduces 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.

scale(hd,pnorm,Name,Value) scales the SOS filter with additional options specified by one or more Name,Value pair arguments.

scale(hd,pnorm,opts) uses an input scale options object opts to specify the optional scaling parameters instead of specifying parameter-value pairs.

scale(hs) scales the filter System object™ hs. You can also use pnorm, name-value pair arguments, or scale option objects with this syntax.

Input Arguments

hd

Discrete-time dfilt filter object.

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.

hs

dsp.BiquadFilter filter System object.

pnorm

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' . The 'L2' norm is equal to the 'l2' norm (by Parseval's theorem), but this equivalency does not hold 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'), '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. The default scaling 'Linf' (default) is the most commonly used scaling norm.

opts

Scale options object. You can create the opts object using the scaleopts function.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'Arithmetic'

For filter System object inputs only, specify the arithmetic used during analysis. When you specify 'double' or 'single', the function performs double- or single-precision analysis. When you specify 'fixed' , the arithmetic changes depending on the setting of the CoefficientDataType property and whether the System object is locked or unlocked.

 Details for Fixed-Point Arithmetic

When you do not specify the arithmetic, the function uses double-precision arithmetic if the filter System object is in an unlocked state. If the System object is locked, the function performs analysis based on the locked input data type.

'MaxNumerator'

Maximum allowed value for numerator coefficients.

Default: 2

'MaxScaleValue'

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.

Default: 'Not Used'

'NumeratorConstraint'

Specifies whether and how to constrain numerator coefficient values. Possible options:

  • ‘none' (default)

  • ‘normalized'

  • ‘po2'

  • ‘unit'

'OverflowMode'

Sets the way the filter handles arithmetic overflow situations during scaling. If your device does not have guard bits available, and you are using saturation arithmetic for filtering, use 'satall' instead of 'saturate'. The default is ‘wrap'.

'ScaleValueConstraint'

Specify whether to constrain the filter scale values, and how to constrain them. 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. ‘unit' is the default value.

'sosReorder'

Reorder filter sections prior to applying scaling. Possible options:

  • ‘auto' (default)

  • ‘none'

  • ‘up'

  • ‘down'

  • ‘lowpass'

  • ‘highpass'

  • ‘bandpass'

  • ‘bandstop'

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)

References

Dehner, G.F. "Noise Optimized Digital Filter Design: Tutorial and Some New Aspects." Signal Processing. Vol. 83, Number 8, 2003, pp. 1565–1582.

Was this topic helpful?