void ZeroPoleToSOS(TVec sos, TVec z, TVec p, Double k)
Convert a zero-pole transfer function to a cascade of second-order sections (SOS).
| # | Name | Description |
|---|---|---|
| 1 | sos | Destination vector |
| 2 | receives the packed second-order sections (real). | |
| 3 | z | Zeros (equal in count to p |
| 4 | real or complex-conjugate). | |
| 5 | p | Poles (equal in count to z |
| 6 | non-empty | |
| 7 | real or complex-conjugate). | |
| 8 | k | Overall system gain, applied to the final section numerator. |
Result: stored in self (calling object)
Factors the rational polynomial with zeros Z, poles P and gain K into a product of biquad sections H(s) = K prod_i (a_i s^2 + b_i s + c_i)/(d_i s^2 + e_i s + f_i) = K ((s-z_1)...(s-z_n))/((s-p_1)...(s-p_n)) . H(s) = num_sos1(s)/den_sos1(s) ... num_sosN(s)/den_sosN(s) = K ((s-sz1)...(s-szn))/((s-sp1)...(s-spn))
szn - n'th zero spn - n'th pole K - system gain
The destination vector sos is packed section-by-section as Num1, Den1, Num2, Den2, ..., DenN; each numerator and each denominator occupies three reals representing a x^2 + b x + c (so a full section is six reals). The gain K is applied to the numerator of the LAST section only. All output coefficients are real; complex zeros/poles must appear as conjugate pairs.
Domain / contract: Z and P must have the SAME length (this routine pairs zeros and poles two-at-a-time and does NOT pad with extra zeros); P must be non-empty; Z and P must share the same floating-point precision. Violating any of these raises an exception.