Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

scale

Scale second-order sections of dsp.BiquadFilter System object

Syntax

scale(biquad)
biquadnew = scale(biquad)
scale(biquad,pnorm)
scale(biquad,pnorm,Name,Value)
scale(biquad,pnorm,opts)
scale(biquad,'Arithmetic',ARITH)

Description

scale(biquad) scales the dsp.BiquadFilter System object™, biquad, using peak magnitude response scaling (L-infinity, 'Linf'). This scaling reduces the possibility of overflows when your filter biquad operates in fixed-point arithmetic mode.

biquadnew = scale(biquad) generates a new filter System object, biquadnew, with scaled second-order sections. The original filter System object, biquad, is not changed.

scale(biquad,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 norms are 'l1', 'l2', and 'linf'. Valid frequency-domain norms are 'L1', 'L2', and 'Linf'. Note that L2-norm is equal to l2-norm (Parseval's theorem) but the same is not true for other norms.

The different norms can be ordered in terms of how stringent they are as follows: 'l1' >= 'Linf' >= 'L2' = 'l2' >= 'L1' >= 'linf'.

Using the most stringent scaling, 'l1', the filter is the least prone to overflow, but also has the worst signal-to-noise ratio. Linf-scaling is the most commonly used scaling in practice.

scale(biquad,pnorm,Name,Value) specifies optional scaling parameters via by one or more Name,Value pair arguments.

scale(biquad,pnorm,opts) uses an options object to specify the optional scaling parameters in lieu of specifying parameter-value pairs. The opts object can be created using the scaleopts method: opts = scaleopts(biquad).

scale(biquad,'Arithmetic',ARITH) assumes that the filter arithmetic is equal to ARITH. ARITH can be set to one of 'double', 'single', or 'fixed'. The scale method assumes a double precision filter when the arithmetic input is not specified and the filter System object is in an unlocked state. If 'Arithmetic' is 'double' or 'single', the default values are used for all scaling options that are not specified as an input to the scale method. If 'Arithmetic' is 'fixed', the values used for the scaling options are set according to the settings in the filter System object, biquad. However, if a scaling option is specified that differs from the settings in biquad, this option is used for scaling purposes but does not change the setting in biquad. For example, if you do not specify the 'OverflowMode' scaling option, the scale method assumes that the 'OverflowMode' is equal to the value in the OverflowAction property of the System object, biquad. If you do specify an 'OverflowMode' scaling option, then the scale method uses this overflow mode value regardless of the value in the OverflowAction property of the System object.

Input Arguments

biquad

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'

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

collapse all

Demonstrate the Linf-norm scaling of a biquad filter using the scale function.

Fs = 8000; Fcutoff = 2000;
[z,p,k] = butter(10,Fcutoff/(Fs/2)); [s,g] = zp2sos(z,p,k);
biquad = dsp.BiquadFilter('Structure', 'Direct form I', ...
    'SOSMatrix', s,'ScaleValues', g);
scale(biquad,'linf','scalevalueconstraint','none','maxscalevalue',2)

References

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

See Also

Functions

Introduced in R2011a

Was this topic helpful?