I am trying to make a minimum phase filter (in wxMaxima) according to these steps:
first create a "normal" FIR (a simple sinc, wc=0.4, random example, but in the pictures a remez with Octave)
calculate the zeroes (allroots() function)
delete the zeroes outside the unit circle (anything>1/0.98, tolerances&co)
delete half of the zeroes on the unit circle (the conjugate pairs, 0.98 < x < 1/0.98)
reconstruct the polynomial => coefficients.
As I understand it, these are the correct steps to follow, but this is what I'm getting:
and this only if I don't delete half the zeroes. If I do, no matter how I sort, choose, etc, I get bogus results. Is this the right way to achieve a minimum phase? I can provide the wxMaxima approach if needed (I tested it first to see if I can reconstruct the original impulse and I could do it, so obtaining the coefficients is not the problem, but the how to).
I wanted to add this later that day but got busy. Here's a graph showing the frequency response of the four filters, ignore the blatant uglyness in attenuation, it's meant to be an example. The 2nd is by zero inversion (and doubling), the 3rd is by spectral factorization and the 4th is like the 3rd only done by geometric mean between adjacent zeroes, to avoid the manual tweaking of adding the DC offset to h[M/2]:
Here are the zeroes:
The idea with the geometric mean came after realizing that the response of the equiripple wasn't quite equiripple, so adding $\delta_2$ to h[M/2] was tricky (you can see the green zeroes aren't quite overlapping). This also gave me the idea that I can use it with non-equiripple, too (that pdf implies the method can only be applied there). Sure enough, here's the result:
Of course, windowing with a Kaiser (Dolph-Chebyshev, or exponential, or cosh) window(s) should be necessary to compensate for the stop-band. Here's a quick example with a Hamming window:
I think the geometric mean ($\sqrt{z_1 \cdot z_2}$) comes as a good alternative, as long as the zeroes are fairly evenly-spaced, otherwise choosing between non-overlapping zeroes (see the green ones) results in going away from their center.
After this I reached the conclusion that if you need a minimum-phase FIR then it's safe to go for an inverse Chebyshev IIR for the sake of less computation power. The half-order minimum phase might be worth it in terms of delay, but it's a pain matching the amplitude. Here are some results with LTspice, showing two FIRs with N=64, linear and nimimum phase, and an inverse Chebyshev IIR (not Cauer, chosen for flatness and similarity in response) with N=11 and matching attenuation:
And, for the sake of comparison, here are the phases of the min.-ph. FIR and the inv. Cheb. IIR:
...and the step responses of all three:
1-z
ones), if your intent is getting the square root of the magnitude, otherwise you need to keep them all intact (as I said, see the answer below, and the follow up comments). $\endgroup$