19 votes
Accepted

Filter Order Rule of Thumb

My favorite "Rule of thumb" for the order of a low-pass FIR filter is the "fred harris rule of thumb": $$ N=\frac{f_s}{\Delta f}\cdot\frac{\rm atten_{dB}}{22} $$ where $\Delta f$ ...
Dan Boschen's user avatar
  • 50.3k
17 votes
Accepted

Single-pole IIR low-pass filter - which is the correct formula for the decay coefficient?

The given single-pole IIR filter is also called exponentially weighted moving average (EWMA) filter, and it is defined by the following difference equation: $$y[n]=\alpha x[n]+(1-\alpha)y[n-1],\qquad ...
Matt L.'s user avatar
  • 89.5k
13 votes
Accepted

Are all IIR filters unstable in nature?

Note that for stable IIR filters, the impulse response does approach zero as $n$ goes to infinity. It just never becomes exactly zero. However, the sum of the absolute values is finite. Just as an ...
Matt L.'s user avatar
  • 89.5k
13 votes
Accepted

FFT-based fast convolution vs IIR filtering

For a simple 10-band equalizer, it would be very hard to beat the IIR implementation. For most HW architectures the break-even point between direct FIR convolution and Overlap Add/Save (OLA) is ...
Hilmar's user avatar
  • 44.1k
12 votes

What is the maximum output of an IIR filter?

I would like to know,if there is any way to estitmate what could be the maximum limits of the output Yes. It's $$y_{max} = x_{max} \cdot \sum_{n = 0}^{\infty} |h[n]| $$ I.e. the maximum gain is the ...
Hilmar's user avatar
  • 44.1k
10 votes

Applying filter in scipy.signal: Use lfilter or filtfilt?

Answer by @endolith is complete and correct! Please read his post first, and then this one in addition to it. Due to my low reputation I was unable to respond to comments where @Thomas Arildsen and @...
drgrujic's user avatar
  • 201
9 votes
Accepted

Is $y[k] = y[k-1] + x[k]$ an integrator?

The system $$y[n]=y[n-1]+x[n]\tag{1}$$ is an ideal accumulator, i.e., it computes the cumulative sum of the input samples: $$y[n]=\sum_{k=-\infty}^nx[k]\tag{2}$$ It is in a way analogous to a ...
Matt L.'s user avatar
  • 89.5k
9 votes
Accepted

Cutoff frequency of a first order recursive filter

That formula for the cut-off frequency is a very inaccurate approximation. In this answer I derived the exact relation between the coefficient of a first order recursive averaging filter and its 3-dB ...
Matt L.'s user avatar
  • 89.5k
9 votes
Accepted

What is zero-phase filtering and forward-backward filtering?

Zero-phase filtering is a non-causal procedure, so it cannot be done in real time, only offline for IIR filters or pseudo real-time, i.e., with a sufficient delay for FIR filters. A zero-phase filter ...
Matt L.'s user avatar
  • 89.5k
9 votes
Accepted

Jacobian Computation in Least Squares IIR Filter Design

The Jacobian is not computed numerically but analytically and then just evaluated. The frequency response of the IIR filter is $$H(e^{j\omega})=\frac{b_0+b_1e^{-j\omega}+\ldots+b_Me^{-jM\omega}}{1+...
Matt L.'s user avatar
  • 89.5k
9 votes
Accepted

Meaning of Phase response of a filter? In simple words?

There are many good answers here. I will try to take the reverse approach in order to explain in very simple words what is necessary in order to keep the output's shape same as input's, and what ...
DSP Rookie's user avatar
  • 2,611
9 votes
Accepted

Why can't realisable IIR filters have linear phase?

The frequency response of a real-valued discrete-time system with linear phase has the form $$H(e^{j\omega})=A(\omega)e^{-j\omega\tau},\qquad\omega\in [-\pi,\pi]\tag{1}$$ where $A(\omega)$ is either ...
Matt L.'s user avatar
  • 89.5k
9 votes
Accepted

How do software equalizers work?

This depends a lot on how you implement it. A single biquad takes about 10 arithmetic operations. (To be precise a Transposed Form II takes 4-5 multiplies and 3 adds, depending on how the gain ...
Hilmar's user avatar
  • 44.1k
8 votes
Accepted

How does this "simple filter" work?

In more standard DSP terms, you have the following filter: $$ y[n] = (1-a) x[n] + a y[n-1] $$ where $x[n]$ and $y[n]$ are the input and output signals at time $n$ respectively. The transfer ...
Juancho's user avatar
  • 5,016
8 votes
Accepted

4th order high-pass filter on a DSP: standard or biquads?

The two solutions in a floating point implementation are assumed to be identical, with the two BiQuads being a factored version of the standard difference equation. The BiQuad is the better way to go ...
Dan Boschen's user avatar
  • 50.3k
8 votes
Accepted

Design a linear-phase FIR filter approximating the magnitude of a given IIR filter

What you do in step 1 is simply truncate the infinite impulse response to approximate it by an FIR filter. If you use sufficiently many filter taps, the approximation becomes arbitrarily accurate. ...
Matt L.'s user avatar
  • 89.5k
8 votes
Accepted

3 dB cut-off frequency of first-order IIR high-pass filter

A discrete-time first-order high pass filter with unity gain at Nyquist and a zero at DC is described by the following difference equation: $$y[n]=\frac{1+\alpha}{2}\big(x[n]-x[n-1]\big)+\alpha y[n-1],...
Matt L.'s user avatar
  • 89.5k
8 votes
Accepted

Are IIR filters (and specifically Butterworth filter) causal?

Yes, Butterworth are IIR. The decay from an impulse technically lasts forever. Yes, all [implementable] IIR are causal. Yes, because of #1 and #2. Don't use ...
endolith's user avatar
  • 15.7k
8 votes

Mapping of Classic Filters for Digital Filter Design

I'm convinced that depending on the problem we're trying to solve, we can and should use both approaches: the transformation of classic analog filter designs, and the direct design in the digital ...
Matt L.'s user avatar
  • 89.5k
7 votes

What's the advantage of adaptive IIR filter against FIR?

These are the key differences between FIR and IIR filters, regarding the feature you wish to control are the following: $$ \begin{array}{c|lcr} \text{Feature} & \text{IIR} & \text{FIR} \\ \...
Brethlosze's user avatar
  • 1,420
7 votes

Frequency Domain Filtering

This is just "faking" the magnitude response of an IIR filter. The output's magnitude spectrum looks just like it has been filtered by the IIR filter with the given frequency response. Although it may ...
msm's user avatar
  • 4,255
7 votes
Accepted

Advancing a causal IIR filter's impulse response

Let's consider a causal IIR filter with the following transfer function: $$H(z)=\frac{B(z)}{A(z)}=\frac{\displaystyle\sum_{n=0}^{M}b[n]z^{-n}}{1+\displaystyle\sum_{n=1}^{N}a[n]z^{-n}}\tag{1}$$ Note ...
Matt L.'s user avatar
  • 89.5k
7 votes
Accepted

Protect an IIR filter from being reverse-engineered

Short answer: You can't. If an attacker can insert a signal that covers the whole bandwidth (e.g. a white signal, or at least one that has no spectral zeros) into the system (and he can do that over ...
Marcus Müller's user avatar
7 votes

Single pole IIR filter, fixed point design

One thing to consider when implementing an IIR filter, whatever the order, is quantization and limit cycles. Let me show you with a quick example with your original filter $y[n] = a*x[n]+(1-a)*y[n-1]...
Ben's user avatar
  • 3,735
7 votes
Accepted

Recursive, non-recursive systems; FIR, IIR systems

The logical implications are the following: "non-recursive" $\Longrightarrow$ FIR IIR $\Longrightarrow$ "recursive" But the opposites are not necessarily true because a FIR system ...
Matt L.'s user avatar
  • 89.5k
7 votes
Accepted

Mapping of Classic Filters for Digital Filter Design

and simulation where "copying the analog" would result in the better solution. That' missing the point a bit. It's not that one cares much about matching or copying the "analog" ...
Hilmar's user avatar
  • 44.1k
7 votes

IIR Filter Implementation in C results in unstable system response

Using 64-bit floats just papers over an underlying problem. As a polynomial increases in order, the positions of the zeros gets ever more sensitive to the values of the lowest-order terms. Moreover, ...
TimWescott's user avatar
  • 12.6k
7 votes
Accepted

how to implement 0.05Hz high pass filter?

First Order IIR DC Nulling Filter A high pass filter with a very low cut-off frequency is commonly referred to as a "DC Nulling Filter" where the interest is in removing the average offset ...
Dan Boschen's user avatar
  • 50.3k
6 votes

How to design very narrow, sharp lowpass filters - Only DC needed?

Your questions still leave me wondering as to what you're actually designing. For software implementation on modern x86 CPUs, CICs make almost no sense, but they are extremely elegant in hardware. ...
Marcus Müller's user avatar
6 votes

Is $y[k] = y[k-1] + x[k]$ an integrator?

Your simple integrator is called a "Rectangular Rule" integrator. There are more complicated (and more accurate) integrators called "Trapazoidal Rule", "Simpson's Rule", and "Tick's Rule" integrators.
Richard Lyons's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible