sos
Convert to second order sections
Description
converts a IIR discrete-time filter System object™ to second-order section (SOS) form. The sysobjsos
= sos(sysobj
)sysobjsos
output
is a dsp.BiquadFilter
System object.
Examples
Convert IIR Discrete-time Filter to SOS Form
Convert an IIR discrete-time filter object to a biquadratic filter object that contains the corresponding SOS sections.
Design a 10th order lowpass Butterworth filter using the butter
function.
N = 10; Fc = 0.4; [b,a] = butter(N,Fc);
Create a dsp.IIRFilter
object and assign the designed coefficients to the Numerator
and the Denominator
properties of the object.
iir = dsp.IIRFilter('Numerator',b,'Denominator',a)
iir = dsp.IIRFilter with properties: Structure: 'Direct form II transposed' Numerator: [4.9945e-04 0.0050 0.0225 0.0599 0.1049 0.1259 ... ] Denominator: [1 -1.9924 3.0195 -2.8185 2.0387 -1.0545 0.4144 ... ] InitialConditions: 0 Show all properties
Use the sos
function to convert the IIR filter object into a biquadratic filter that contains the corresponding SOS sections.
biquad = sos(iir)
biquad = dsp.BiquadFilter with properties: Structure: 'Direct form II transposed' SOSMatrixSource: 'Property' SOSMatrix: [5x6 double] ScaleValues: [6x1 double] InitialConditions: 0 OptimizeUnityScaleValues: true Show all properties
You can access the SOS matrix and the scale value properties of the biquadratic filter.
sMatrix = biquad.SOSMatrix
sMatrix = 5×6
1.0000 2.0958 1.0984 1.0000 -0.3187 0.0313
1.0000 2.0576 1.0602 1.0000 -0.3345 0.0826
1.0000 1.9981 1.0005 1.0000 -0.3695 0.1958
1.0000 1.9412 0.9436 1.0000 -0.4317 0.3969
1.0000 1.9073 0.9097 1.0000 -0.5380 0.7410
sValues = biquad.ScaleValues
sValues = 6×1
0.0005
1.0000
1.0000
1.0000
1.0000
1.0000
To verify, compare these values to the values obtained using the tf2sos
function.
[sMatrixfn,g] = tf2sos(b,a)
sMatrixfn = 5×6
1.0000 2.0958 1.0984 1.0000 -0.3187 0.0313
1.0000 2.0576 1.0602 1.0000 -0.3345 0.0826
1.0000 1.9981 1.0005 1.0000 -0.3695 0.1958
1.0000 1.9412 0.9436 1.0000 -0.4317 0.3969
1.0000 1.9073 0.9097 1.0000 -0.5380 0.7410
g = 4.9945e-04
isequal(sMatrix,sMatrixfn)
ans = logical
1
isequal(sValues(1),g)
ans = logical
1
Input Arguments
sysobj
— IIR discrete-time filter object
dsp.IIRFilter
System object
dsp.IIRFilter
System objectIIR discrete-time filter object, specified as a dsp.IIRFilter
System object.
dir_flag
— Pole direction flag
'up'
| 'down'
Pole direction flag, specified as either:
'up'
–– The first row contains the poles closest to the origin, and the last row contains the poles closest to the unit circle.'down'
–– The sections are ordered in the opposite direction. The zeros are always paired with the poles closest to them.
Output Arguments
sysobjsos
— Second order section filter object
dsp.BiquadFilter
System object
dsp.BiquadFilter
System objectSecond order section filter object, returned as a dsp.BiquadFilter
System object. The sos
function converts the input IIR filter
numerator and denominator coefficients into SOS matrix and scale values and assigns
these values to the dsp.BiquadFilter
object.
Version History
See Also
reorder
| scale
| scalecheck
| scaleopts
| cumsec
Abrir ejemplo
Tiene una versión modificada de este ejemplo. ¿Desea abrir este ejemplo con sus modificaciones?
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
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)