# scalecheck

Check scaling of biquadratic filter

## Description

## Examples

### Linf-norm scaling of a filter

This example shows how to check the Linf-norm scaling of a filter.

Design an elliptic SOS filter in the direct form II structure with default specifications.

EllipII = design(fdesign.lowpass,'ellip',FilterStructure='df2sos',... SystemObject=true)

EllipII = dsp.SOSFilter with properties: Structure: 'Direct form II' CoefficientSource: 'Property' Numerator: [3x3 double] Denominator: [3x3 double] HasScaleValues: true ScaleValues: [0.8629 2.0523 0.0127 1] Use get to show all properties

Check the scaling.

`scalecheck(EllipII,'Linf')`

`ans = `*2×3*
3.1678 15.0757 1.4974
4.7360 52.6026 1.0000

Design an elliptic SOS filter in the direct form I structure with default specifications.

EllipI = design(fdesign.lowpass('N,Fp,Ap,Ast',10,0.5,0.5,20),'ellip',... FilterStructure='df1sos',SystemObject=true)

EllipI = dsp.SOSFilter with properties: Structure: 'Direct form I' CoefficientSource: 'Property' Numerator: [5x3 double] Denominator: [5x3 double] HasScaleValues: true ScaleValues: [0.9442 1.0014 1.0170 1.6551 0.1398 1] Use get to show all properties

Check the scaling.

`scalecheck(EllipI,'Linf')`

`ans = `*1×5*
1.7078 2.0807 2.6084 7.1467 1.0000

## Input Arguments

`sysobj`

— Input filter object

`dsp.SOSFilter`

System object | `dsp.BiquadFilter`

System object

`dsp.SOSFilter`

`dsp.BiquadFilter`

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

.

`arithType`

— Arithmetic type

`'double'`

(default) | `'single'`

| `'Fixed'`

Arithmetic type used during analysis, specified as
`'double'`

, `'single'`

, or
`'fixed'`

. The function assumes a double precision
filter when the arithmetic input is not specified and the filter System object is in an unlocked state.

## Output Arguments

`s`

— Filter scaling

scalar | row vector

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 (`df1sos`

) and direct-form II
transposed (`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 (`df2sos`

) and direct-form I
transposed (`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.

**Data Types: **`double`

## Version History

**Introduced in R2011a**

### R2023b: `dsp.BiquadFilter`

object will be removed

The `dsp.BiquadFilter`

object will be removed in a future release.
Use the `dsp.SOSFilter`

object instead.

**Update Code**

This table shows how to replace the `dsp.BiquadFilter`

object with
the `dsp.SOSFilter`

object in a typical workflow.

Discouraged Usage | Recommended Replacement |
---|---|

[z,p,k] = butter(10,2000/(8000/2)); [s,g] = zp2sos(z,p,k); biquad = dsp.BiquadFilter(Structure='Direct form I',... SOSMatrix=s,ScaleValues=g); scalecheck(biquad,'Linf') 0.0115 0.0435 0.1487 0.4324 1.0000 |
[z,p,k] = butter(10,2000/(8000/2)); [s,g] = zp2sos(z,p,k); num = s(:,1:3); den = s(:,4:6); sosFilter = dsp.SOSFilter(Numerator=num,... Denominator=den,... HasScaleValues=true,... ScaleValues=g,... Structure="Direct form I"); scalecheck(sosFilter,'Linf') 0.0115 0.0435 0.1487 0.4324 1.0000 |

## See Also

### Functions

### Objects

## Open Example

You have a modified version of this example. Do you want to open this example with your edits?

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)