Documentation

scalecheck

Check scaling of SOS filter

Syntax

s = scalecheck(hd,pnorm)
s = scalecheck(hs,pnorm)
s = scalecheck(hs,pnorm,Name,Value)

Description

s = scalecheck(hd,pnorm) checks the scaling second-order section (SOS) dfilt filter object hd.

s = scalecheck(hs,pnorm) checks the scaling of the filter System object™ hs.

s = scalecheck(hs,pnorm,Name,Value) checks the scaling of the filter System object hs with additional options specified by one or more Name,Value pair arguments.

Input Arguments

expand all

hd

Discrete-time dfilt.df1sos, dfilt.df2tsos, dfilt.df2sos, or dfilt.df1tsosfilter object.

hs

dsp.BiquadFilter filter System object.

pnorm — Different types of norm:'l1' | 'l2' | 'linf' | 'L1' | 'L2' | 'Linf'

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'.

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' — Value type:‘double' | 'single' | 'fixed'

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.

Output Arguments

s

Filter scaling for a given p-norm. An optimally scaled filter has partial norms equal to one. In such cases, s contains all ones.

For direct-form I (dfilt.df1sos) and direct-form II transposed (dfilt.df2tsos) filters, the function returns the p-norm of the filter computed from the filter input to the output of each second-order section. Therefore, the number of elements in s is one less than the number of sections in the filter. This p-norm computation does not include the trailing scale value of the filter, which you can find by entering hd.scalevalue(end) at the MATLAB prompt.

For direct-form II (dfilt.df2sos) and direct-form I transposed (dfilt.df1tsos) filters, the function returns a row vector whose elements contain the p-norm from the filter input to the input of the recursive part of each second-order section. This computation of the p-norm corresponds to the input to the multipliers in these filter structures. These inputs correspond to the locations in the signal flow where overflow should be avoided.

When hd has nontrivial scale values, that is, if any scale values are not equal to one, s is a two-row matrix, rather than a vector. The first row elements of s report the p-norm of the filter computed from the filter input to the output of each second-order section. The elements of the second row of s contain the p-norm computed from the input of the filter to the input of each scale value between the sections. For df2sos and df1tsos filter structures, the last numerator and the trailing scale value for the filter are not included when scalecheck checks the scaling.

Examples

Check the Linf-norm scaling of a filter.

% Create filter design specifications
hs = fdesign.lowpass; 
object.
hd = ellip(hs);       % Design an elliptic sos filter
scale(hd,'Linf');
s = scalecheck(hd,'Linf')

In another form:

[b,a]=ellip(10,.5,20,0.5);
[s,g]=tf2sos(b,a);
hd=dfilt.df1sos(s,g)

hd =

         FilterStructure: 'Direct-Form I, Second-Order Sections'
              Arithmetic: 'double'
               sosMatrix: [5x6 double]
             ScaleValues: [6x1 double]
        PersistentMemory: false
                  States: [1x1 filtstates.dfiir]

1x1 struct array with no fields.

scalecheck(hd,'Linf')

ans =

    0.7631    0.9627    0.9952    0.9994    1.0000

See Also

| | |

Was this topic helpful?