sos
Convert to second order sections
Description
Examples
Convert an IIR discrete-time filter object to an SOS 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 0.1049 0.0599 0.0225 0.0050 4.9945e-04] Denominator: [1 -1.9924 3.0195 -2.8185 2.0387 -1.0545 0.4144 -0.1157 0.0225 -0.0027 1.4876e-04] InitialConditions: 0 Show all properties
Use the sos
function to convert the IIR filter object into an SOS filter that contains the corresponding SOS sections.
sosFilt = sos(iir)
sosFilt = dsp.SOSFilter with properties: Structure: 'Direct form II transposed' CoefficientSource: 'Property' Numerator: [5×3 double] Denominator: [5×3 double] HasScaleValues: true ScaleValues: [4.9945e-04 1 1 1 1 1] Show all properties
You can obtain the SOS matrix and scale values from the SOS filter object.
sMatrix = [sosFilt.Numerator,sosFilt.Denominator]
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 = sosFilt.ScaleValues
sValues = 1×6
0.0005 1.0000 1.0000 1.0000 1.0000 1.0000
Compare these values to the values obtained using the tf2sos
function and verify that they are the same.
[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
IIR discrete-time filter object, specified as a dsp.IIRFilter
System object.
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
Second order section filter object, returned as a dsp.SOSFilter
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.SOSFilter
object.
Version History
Introduced in R2011aThe dsp.BiquadFilter
object and the
UseLegacyBiquadFilter
flag will be removed in a future
release.
The dsp.BiquadFilter
object and the
UseLegacyBiquadFilter
flag will be removed in a future
release.
The sos
function now generates a dsp.SOSFilter
object
instead of the dsp.BiquadFilter
object.
Initialize a dsp.IIRFilter
object. Use the
sos
function to convert the IIR filter object into a biquadratic filter
that contains the corresponding SOS sections. The output is a dsp.SOSFilter
filter object.
iirFilt = dsp.IIRFilter convFilt = sos(iirFilt)
convFilt = dsp.SOSFilter with properties: Structure: 'Direct form II transposed' CoefficientSource: 'Property' Numerator: [1 1 0] Denominator: [1 0.1000 0] HasScaleValues: false Show all properties
To design a dsp.BiquadFilter
object instead of the
dsp.SOSFilter
object, you can use the
UseLegacyBiquadFilter
flag and set it to
true
.
convFilt = sos(iirFilt,UseLegacyBiquadFilter=true)
convFilt = dsp.BiquadFilter with properties: Structure: 'Direct form II transposed' SOSMatrixSource: 'Property' SOSMatrix: [1 1 0 1 0.1000 0] ScaleValues: [2×1 double] InitialConditions: 0 OptimizeUnityScaleValues: true Show all properties
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.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)