-3

Sinc is $\propto 1/t$. If $x(t)$ is bounded, then there exists $t: |x(t)/t| < \epsilon_M$, where $\epsilon_M$ is machine epsilon. If $x(t)$ is also time-limited, it also means there's $\tau$ such that $\int_{-\infty}^{\infty} |x(t) \text{sinc}(t - \tau)| dt < \epsilon_M$ (i.e. sinc eventually decays enough), meaning

$$ |\left((x * \text{sinc})(t)\right)[n] - (x * \text{sinc})[n]| < \epsilon_M $$

is doable - i.e., the sampling of the exact result is indistinguishable from the result of digital computation.


Plethora, if not vast majority, of real-world signals are time-limited. Hence they can be brickwalled.

So why the saying? Shouldn't it instead be that ideal lowpass isn't ideal? The sinc is infinitely long with terrible decay, meaning the input's time support is stretched out at least a hundredfold. Even with $\epsilon_M=0$, this isn't what we want at all. As shown under "Modulation Model vs Fourier Transform", Fourier "frequencies" most often aren't frequencies at all but artifacts of the transform: it can very well be that, eliminating all $f > 50\ \text{Hz}$ only actually eliminates $f < 30\ \text{Hz}$, physically.

Hence the real advantage of non-sinc is temporal compactness: the output's length is comparable to input's, a must for real-time processing. Of course there's also compute-expense, but this discussion is purely about accuracy, as it seems universally said that we simply cannot brickwall (and if we could, it's "ideal").


Since comments may vanish I've documented them here: 1, 2.

Discussion summary: agreeing with me in comments, disagreeing in answers and votes. Dislike saying it, dislike more seeing it.

OverLordGoldDragon
  • 8,912
  • 5
  • 23
  • 74
  • 5
    What exactly is your question here? Frankly, I don't even get the point your are trying to make. – Hilmar Feb 11 '23 at 14:32
  • @Hilmar You've partly inspired this question by routinely writing what's in the title, so my question is why do you do it if it's wrong? – OverLordGoldDragon Feb 11 '23 at 14:36
  • 3
    What exactly is wrong ? Are you claiming there are ideal lowpass filters ? Is that your point here? – Hilmar Feb 11 '23 at 14:47
  • @Hilmar Yes, I'm claiming the brickwall can be implemented perfectly for time-limited signals, "perfectly" meaning indistinguishable by a computer from the continuous-time result. – OverLordGoldDragon Feb 11 '23 at 14:51
  • 6
    Not sure I can follow that. That feels like an inherent contradiction. If a signal is time limited, it has unlimited bandwidth. Once you brick-wall it, it's limited in frequency, which means the result cannot be limited in time anymore. If your input is time limited and your output isn't, that means that the impulse response of your filter isn't time limited either. Not only isn't it infinitely long, it's also infinitely non-causal, i.e. you would have to started filtering before the big bang. – Hilmar Feb 11 '23 at 14:57
  • 3
    Obviously you can always make it "good enough" within the requirements of your specific application with finite resources, but by my definition what would not be an ideal low-pass filter anymore. My meta point is: a big part of good filter design is to really understand and clarify your requirements. How much low-pass filtering do you really need? The answer "ideal lowpass filter" doesn't hack it. – Hilmar Feb 11 '23 at 14:59
  • "result cannot be limited in time anymore" it's guaranteed to drop below $\epsilon_M$, making it exactly time-limited, per the definition of "exact" I use here. Now, supposing we magically filter it "actually exactly", the final result on the computer will be the same as if it were filtered on the computer without magic - is the point I'm making. Hence I think the strict, $\epsilon_M=0$ criterion, is misleading, if not meaningless. @Hilmar – OverLordGoldDragon Feb 11 '23 at 15:07
  • Your meta point is good, but lacking clarity in presentation, as it's always suggested "(1) ideal is ideal (most desired) (2) but we can never achieve it", both being false. "Impractical" or "can do better" is how I'd put it, rather than "impossible". @Hilmar – OverLordGoldDragon Feb 11 '23 at 15:15
  • 5
    @OverLordGoldDragon I fully agree with Hilmar here, but beyond that, you're handwaving away an awful lot of detail. That one "can approach theory as closely as one wants on a computer" (at least in many practical cases) is not new. The real engineering question is, what is the cost? Being concrete: design a digital filter to low-pass filter a signal sampled at 40 kHz to a cutoff frequency of 5 kHz so the difference is less than 1e-16 from the (continuous-time) theoretical result. A problem you're likely to find is that some filter coefficients become smaller than your machine precision... – MBaz Feb 11 '23 at 16:20
  • 1
    ... making the filter unimplementable on your purported computer anyway. In any case, the next step is to evaluate and characterize your filter: what is its delay? How much computer power does it need? What about its transients? Etc. – MBaz Feb 11 '23 at 16:20
  • @MBaz We don't have to store the filter at face value, there's CS tricks - it is implementable. Now the narrative you're presenting is very different from all I've read so far on countless questions, and it's one that should be presented. "Impossible" is a non-sequitur of "practically useless", and one very harmful to conceptual understanding, which isn't being acknowledged at all. Besides, the more important point that ideal != most desired (if compute doesn't matter) is also lost. – OverLordGoldDragon Feb 11 '23 at 16:32

2 Answers2

2

I think the OPs argument here is

For any given "machine epsilon" (whatever exactly that is) you can determine a truncation length for a sinc() where adding more coefficients will not change the output anymore.

That in itself is obviously a correct statement. The filter you would get this way would be "the best lowpass filter you can get using a truncated sinc and a specific numerical data type or resolution" I think that the OP uses that as the their definition of an "ideal lowpass filter" in a sense of "you can't do any better".

I think the flaw in this argument is referencing it to the "machine epsilon". Given enough resources you can make this as small as you like (or need) using arbitrary bit/word length data types. You are not beholden to "int, float or double".

The second flaw (IMO) is that for most standard data types you end up with a pretty crappy lowpass filter that has extremely high latency and still has significant errors with respect to the formal definition of a brickwall filter. Since you have to accept some amount of errors anyway, you are better off using a filter design that minimizes resource consumption within the requirements of your application. A truncated sinc is often not the best choice here.

Hilmar
  • 44,604
  • 1
  • 32
  • 63
  • Well you're right about machine epsilon but that only reinforces my thesis. But I don't follow "significant errors with respect to the formal definition of a brickwall filter", that appears to contradict the first point. "in a sense of "you can't do any better"" - in a sense that you'd get an identical array by sampling the exact continuous-time result. – OverLordGoldDragon Feb 12 '23 at 10:40
1

I agree with the OP that the “ideal lowpass brickwall filter” isn’t necessarily ideal. A prime example is in a receiver a non-casual matched filter would be “ideal” for optimizing SNR with no delay in white noise conditions, so would be the reverse filter for whatever filter was used in the transmitter (which as non-causal is also not physically implementable).

The definition of an “ideal lowpass brickwall filter” is well defined, and when we consider that definition, it is not physically implementable. Notably the violation of causality and that the frequency domain description is continuous, not discrete. However this does not preclude creating filters that sufficiently approximate a “brickwall” response for a given application.

The statement “ideal lowpass brickwall filter” is used when describing the filtering problem of passing a band of frequencies with no distortion or delay while completely rejecting all other frequencies. This of course is not physically realizable (even if we could pass and reject with an allowably small transition band, the resulting delay required would be far from “ideal”). However understanding this as well as its limits is the first step toward understanding best practices with realizable filter design in terms of the effects of time delay and impulse response truncation. Thus many filtering concepts are first introduced in comparison to an “ideal brickwall” filter (lowpass, highpass or bandpass).

Here is a simple example to demonstrate why there is no physically realizable "brickwall" filter. A brickwall filter specifically has a rectangular magnitude response in the frequency domain. It passes all frequencies up to a passband frequency cutoff $f_c$, and immediately (brickwall) rejects all frequencies above $f_c$. Here I've made a ridiculously long filter with 262144 samples (based on OP’s suggestion in the comments) of a Sinc function using the approach described by the OP.

Filter coefficients on a log scale:

filter coeff

Filter frequency response

brickwall freq response

If we zoom in on the transition region, we see how horrible such a filter construction would be and how far from an "ideal brickwall filter" we are, and certainly not indistinguishable from one:

zoom in

Of course to implement a better filter, we would use windowing in the time domain, but this would also come at the expense of a wider transition band. I've included what this would look like in comparison; with the Sinc impulse response windowed with a Kaiser window using $\beta=12$. At the scale of the full frequency band it certainly appears as a "brickwall":

kaiser windowed

Zooming in on the transition band as done above reveals the wider transition band as a penalty for the windowing that was applied (but well worth it!). Ultimately we see that even with this long FIR filter as suggested by the OP in the comments, the differences from a true "brickwall" filter are quite distinguishable and far from reaching the limits of computing precision:

zoom in kaiser windowed

How we would see the effect of this is not done by evaluating the tail errors of the Sinc in the time domain as suggested by the OP where the result may appear indistinguishable at some arbitrary limit, but rather with test waveforms at frequencies within vicinity of the frequency cutoff. To properly test such a condition in the time domain, use two waveforms, one with a frequency set to $f_c-\Delta$ and the other to $f_c+\Delta$ where $\Delta$ is a small frequency increment on each side of cutoff. The steady state magnitude of the waveform at the output of the filter would be consistent with the frequency domain results I have shown above.

Dan Boschen
  • 50,942
  • 2
  • 57
  • 135
  • "not done by evaluating the tail errors of the Sinc in the time domain" yes it is. These plots aren't representative of my proposed design; they could show -1000000000, then we store at some precision and get back to (e.g.) -10000. And 200,000 is far from long enough, you need 1e16 to get 1e-16 in sinc (assuming t=arange). Also per Hilmar's note we could drive it even below -1000000000 and store it. – OverLordGoldDragon Feb 12 '23 at 10:55
  • "nor anything we would ever implement" I routinely work with 262144-long filters, and folks in bioacoustics yet longer. – OverLordGoldDragon Feb 12 '23 at 11:31
  • @OverLordGoldDragon Regardless even filters that long or 10x longer are not brickwall filters, and not indistinguishable at the precision computers allow. It's important for all that we use generally accepted terminology for our definitions. When we use those definitions, a brickwall filter is well defined and not physically feasible. What I was referring to that typically would not be done for a good filter design is designing the filter as a simple truncated Sinc. – Dan Boschen Feb 12 '23 at 11:49
  • "and not indistinguishable at the precision computers allow" I've mathematically proven otherwise. You could confirm the CS side on StackOverflow. – OverLordGoldDragon Feb 12 '23 at 11:55
  • @OverLordGoldDragon I've updated my answer for your case. Same result. I suspect you aren't considering two closely spaced frequencies with one that passes and the other rejected? The length of such a filter that reaches the limits of precision that computers allow would take years to run! – Dan Boschen Feb 12 '23 at 12:39
  • "years to run" sure. Doesn't mean can't. Can't is breaking Heisenberg in general case, can't is lossless compression of all inputs - there's lots of can't's, this isn't one of them. Of course it becomes can't if compute constraints are a must, but the impossibility point is being made independently. It's shouldn't. – OverLordGoldDragon Feb 12 '23 at 12:45
  • @OverLordGoldDragon I agree with you. But then this question comes down to "opinion based". A brickwall filter to me is very well defined. Feasibility vs impossibility are also two very different things. – Dan Boschen Feb 12 '23 at 12:50
  • The question is more than its title. The points everyone's made as if to contradict me, I've made in the body. My concern is with impossibility, there's no opinion there. "Shouldn't it instead be that ideal lowpass isn't ideal?" is opinion, sure, but then so are all the answers that use the phrase "ideal lowpass". – OverLordGoldDragon Feb 12 '23 at 12:57
  • I say impossibility with your definitions. As it is not impossible to make a machine with X bits for any X. (Using the same logic). I'm sorry, I don't see the benefit of this question – Dan Boschen Feb 12 '23 at 13:00
  • Well that's unfortunate since my target is the teaching of the concept, and I've heard that concerns you. The existing presentation has been misleading me for years, nor can I imagine it differing for others. – OverLordGoldDragon Feb 12 '23 at 13:05
  • Bumped to this near-ideal low-pass or band-pass brickwall filter implementation (dunno how to use it in Octave so could not test run it by myself ): https://se.mathworks.com/matlabcentral/fileexchange/42956-sinc-filter?s_tid=srchtitle – Juha P Feb 12 '23 at 16:58
  • @JuhaP That looks like filtering using the DFT to create a Dirichlet Kernel as the filter (time aliased Sinc). Due to the time aliasing, that will have even worst performance than the examples I gave above. To do in octave simply make a noncausal integer index n from −(N−1)/2 to +(N−1)/2 for N odd total coefficients and then compute the coefficients using c=2B sinc (2Bn) where B is your fractional one-sided bandwidth in cycles/sample (from 0 to .5). – Dan Boschen Feb 12 '23 at 21:53