My question is related to this one: Correcting phase response of a signal.
I need to design an FIR low-pass filter with real coefficients for data received from a sensor. An additional requirement is to try and equalize to phase distortion introduced by the sensor (we have measurements of it).
While I could in theory design an allpass in addition to the low pass, I prefer not to as I care about the overall delay more than the distortion.
However, I thought maybe I can design a single filter doing both low-pass and phase equalization. I will consider the solution suggested by Matt here, but first I thought of a simple solution which already builds on FIR which I designed and I'm happy with. Can't I simply:
- Take the frequency response of the filter I have
- Multiply the positive frequencies by the by the desired phase response, and negative ones by the conjugate.
- Take the inverse transform (
invfreqz) to find filter taps
- How does this approach compare to LS or complex PM design algorithms?
- My intuition is that this approach (given the the LPF was designed using
firls), will maintain its performance as a low pass, and will somewhat sacrifice the phase performance as it hasn't been optimized in any sense. Am I correct?
- It sounds as if I'm getting here "something for free" and we all know there are no free lunches when it comes to engineering. What am I sacrificing compared to the original LPF?
- I've stumbled upon some notions that such arbitrary phase FIRs aren't necessarily causal. Obviously the group delay of my filter will be altered (this is my goal by adding phase, not a consequence). How will the resulting filter be non-causal? I assume it it happens if the phase is large enough compared to the linear phase of the original filter? If so, assuming added phase is smaller than the $N/2$ delay of the FIR, I don't see an issue. Am I missing something?
- What will happen to the temporal characteristics of the filter, such as ringing effects, overshoot and undershoots?
The only draw back I found so far is the since the resulting filter will not be symmetric (by design), I cannot save hardware taps by exploiting symmetry.
So I tied both
lslevin, trimming the IFFT, and
invfreqz (both with weights provided and without them, as the documentation states the algorithm used is different). Attached are frequency response and group delay plots of the results, both for a $N=17$ order filter and for a $N=35$ order filter.
Surprisingly, there are fundamental differences which I do not understand intuitively.
- For some reason the magnitude response of the of the non-linear phase filter has better noise rejection than the linear phase, but only for the short filter. Obviously the standard LS design is optimal only as long as the problem is constrained to linear phase filter, so the better noise rejection for the non-linear phase filter is understandable, but why does it occur only for the shorter filter?
- For the $N=17$ filter GD approximation is quite bad, but it is better with the unweighted
invfreqzand IFFT. For the longer filter the weighted variant approaches the GD approximation performance of the other two within passband. Is there an intuitive/fundamental reason for this, or is it a coincidence?