Is this the correct way to write the filter equation of a df2sos filter ?

Hey All,
I could use some help converting filter coefficients to an analytical filter equation. From the Filter Design Tool Fdatool, I obtained the coefficients of a 4th order butterworth filter in "Direct Form II - Second - Order - Section" DF2SOS (see below for coefficients).
After some advice from Honglei Chen, I obtained the following form but I am not sure I have done it correctly:
Incase of 4th order butterworth order, the filter equation becomes
v(n)=x(n)-a1.v(n-1)-a2.v(n-2)-a3.v(n-3)
where a1 - a2 - a3 are the coefficients of my denominator. Then, in the second equation I follow the same reasoning but then using the coefficient of my nominator multiplied by the gain of the section.
y(n)=G[b0.v(n)+b1.v(n-1)+b2.v(n-2)+b3.v(n-3)] This leaves me with 4 equations 2 for each section.
Thank you for your time, Yosef
These are the coefficients:
Section #1
Numerator
1; 2; 1
Denominator
1; 1.949215958025842; 0.953069895327891
Gain: 9.634843255122908e-04
Section #2
Numerator
1; 2; 1
Denominator
1; 1.886609582621506; 0.890339736284024
Gain: 9.325384156294744e-04
Output gain: 1

 Risposta accettata

You can use sos2tf to obtain the numerator and denominator coefficients from the second-order section matrix and the vector of gain values.
d = fdesign.lowpass('N,F3dB',4,0.25);
D = design(d,'butter');
[B,A] = sos2tf(D.sosMatrix,D.ScaleValues);
fvtool(B,A)
In the above, you now have your numerator, B, and denominator, A, coefficients.

3 Commenti

Hello Wayne,
Thank you for taking the time to reply. In the tool above, I see a new filter is being created. My intention is to use the above coefficients and fill them into an analytical expression:
These equation are representative of the DF2SOS system
In these equations what is a1, a2, b0, b1 & b2 from the matrices I provided above? There seems to be no gain component or is that b0, b1, b2?
Another idea, I got from your method is perhaps to use the sosMatrix & scalevalues from my data and convert them into a transfer function.
Thanks again
Hi Yosef,
The diagram you mention above is only for one section. And yes within each section, you can fill in those numbers directly from the numerator and denominator. For the gain, I think I've seen two conventions. One of them lists it as a separate block, and others just absorb them into b. So you can do either one of them.
BTW, as an additional note on Wayne's answer. You can also get the transfer function directly by doing
[B,A] = tf(D)
HTH
Hello Honglei Chen,
I think I understand. Incase of 4th order, I should have an additional v(n-3) term so the equation becomes
v(n)=x(n)-a1.v(n-1)-a2.v(n-2)-a3.v(n-3)
where a1 - a2 - a3 are the coefficients of my denominator. Then, in the second equation I follow the same reasoning but then using the coefficient of my nominator multiplied by the gain of the section.
y(n)=G[b0.v(n)+b1.v(n-1)+b2.v(n-2)+b3.v(n-3)] This leaves me with 4 equations 2 for each section.
Did I get your explanation right??

Accedi per commentare.

Più risposte (1)

I think I finally got it. Thanks Wayne & Honglei.
I used the sos2tf to convert all the SOS Matrices & Scale Values into a transfer function form. Then fill them into this equation:

Categorie

Scopri di più su MATLAB in Centro assistenza e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by