matlab sos matrix,Convert to second order sections

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: [1x11 double]

Denominator: [1x11 double]

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值