Hot answers tagged

37

OK, I'll try to answer your questions: Q1: the number of taps is not equal the to the filter order. In your example the filter length is 5, i.e. the filter extends over 5 input samples [$x(n), x(n-1), x(n-2), x(n-3), x(n-4)$]. The number of taps is the same as the filter length. In your case you have one tap equal to zero (the coefficient for $x(n-1)$), so ...


24

Citing Bellanger's classic Digital Processing of Signals – Theory and Practice, the point is not where your cut-off frequency is, but how much attenuation you need, how much ripple in the signal you want to preserve you can tolerate and, most importantly, how narrow your transition from pass- to stopband (transition width) needs to be. I assume you want a ...


18

Let me add the following graphic to the great answers already given. When a filter has linear phase, then all the frequencies within that signal will be delayed the same amount in time (as described mathematically in Fat32's answer). Any signal can be decomposed (via Fourier Series) into separate frequency components. When the signal gets delayed through ...


17

Digital filter design is a very large and mature topic and - as you've mentioned in your question - there is a lot of material available. What I want to try here is to get you started and to make the existing material more accessible. Instead of digital filters I should actually be talking about discrete-time filters because I will not consider coefficient ...


17

A linear phase filter will preserve the waveshape of the signal or component of the input signal (to the extent that's possible, given that some frequencies will be changed in amplitude by the action of the filter). This could be important in several domains: coherent signal processing and demodulation, where the waveshape is important because a ...


16

I agree that the windowing filter design method is not one of the most important design methods anymore, and it might indeed be the case that it is overrepresented in traditional textbooks, probably due to historical reasons. However, I think that its use can be justified in certain situations. I do not agree that computational complexity is no issue ...


14

For a quick and very practical estimate, I like fred harris' rule-of-thumb: $$ N_{taps} = \frac{Atten}{22*B_T}$$ where: Atten is the desired attenuation in dB, $B_T$ is the normalized transition band $B_T=\frac{F_{stop}- F_{pass}}{F_s}$, $F_{stop}$ and $F_{pass}$ are the stop band and pass band frequencies in Hz and $F_s$ is the sampling frequency in ...


12

Just to add to what's already been said, you can see this intuitively by looking at the following sinusoid with monotonically increasing frequency. Shifting this signal to the right or left will change its phase. But note also that the phase change will be larger for higher frequencies, and smaller for lower frequencies. Or in other words, the phase ...


11

The essence and importance of linear phase property lies in the definition and the effect of group delay $$\tau(\omega) = - \frac {d\phi(\omega)}{d\omega}$$ on the applied signal $x[n]$, where $\phi(\omega)$ is the phase response of the filter; (phase of its frequency response). Assume that a filter, with a fixed group delay of $n_0$ samples, is applied a ...


11

My favorite "Rule of thumb" for the order of a low-pass FIR filter is the "fred harris rule of thumb": $N=[f_s/delta(f)]*[atten(dB)/22]$ where delta(f) is the transition band, in same units of $f_s$ $f_s$ is the sample rate of the filter atten(dB) is the target rejection in dB For example if you have a transition band of 100 Hz in a system sampled at 1KHz,...


11

See How many taps does an FIR filter need? In your case you'd need more than 1000 taps depending on the allowable ripple, as your cut-off frequency is less than fs/500. Alternatives : use an IIR, a simple order-1 DC removal filter could work great Average your signal and subtract the average in order to remove the DC Rick Lyons proposes a clever ...


10

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 example, take the exponential impulse response $$h[n]=a^nu[n],\qquad |a|<1\tag{1}$$ where $u[n]$ is the unit step function. The sum $$\sum_{n=-\infty}^{\...


10

The answer to this question is already been explained clearly in the previous replies. Yet I wish to give it a try to present a mathematical interpretation of the same Consider a linear time invariant System whose frequency response is governed by $H(w)$. i.e if the input to this system is $e^{jw_{0}t}$ the output will be $H(w_{0})e^{jw_{0}t}$ Here $H(w_{...


10

In reviewing fred harris Figures of Merit for various windows (Table 1 in this link) the Hamming is compared to the Hanning (Hann) at various values of $\alpha$ and from that it is clear that the Hanning would provide greater stopband rejection (The classic Hann is with $\alpha =2$ and from the table the side-lobe fall-off is -18 dB per octave). I provided ...


10

Note the difference between the zeros at $0.3 \pi$ and at $0.8 \pi$. The first one is clearly a zero crossing, much like $abs(x)$ at $x=0$. At $\theta = 0.8 \pi$, however, the curve is tangent to the horizontal axis, much like $x^2$ at $x=0$. So you have a doulbe zero here. So your zeros are: 2 zeros at $z = e^{\pm j 0.3 \pi}$ 2 double zeros at $z = e^{\...


7

I would say that the answer to your question - if taken literally - is 'no', there is no general way to simply convert an FIR filter to an IIR filter. I agree with RBJ that one way to approach the problem is to look at the FIR filter's impulse response and use a time domain method (such as Prony's method) to approximate that impulse response by an IIR ...


7

Adding to the accepted answer, a few additional references. I won't write the formulas which can be involved. Those formulae mostly yield rule-of-thumbs or approximations to start from. You can fiddle around these numbers for your actual design. One of the origin for Bellanger's design is: On computational complexity in digital filters, 1981, Proc. Eur. ...


7

Windowed Sinc filters can be adaptively generated on the fly on processors barely powerful enough to run the associated FIR filter. Windowed Sinc filters can be generated in finite bounded time. The generation of some simple windowed Sinc filters can be completely described (and inspected for malware, etc.) in a few lines of code, versus blind use of some ...


6

In the general case you have $$H(z)=\frac{P(z)}{Q(z)}$$ where $P(z)$ and $Q(z)$ are polynomials in $z$. If - as is the case in your example - $Q(z)$ just has one single term, $H(z)$ is definitely FIR, because you can simply divide each term of $P(z)$ by that respective power of $z$, and the number of terms of $H(z)$ equals the number of terms of $P(z)$. ...


6

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. These filter definitions are ridiculous if you're planning to use a FIR – a transition width of 1mHz means that a minimum phase equiripple filter [1, (5.75), p. ...


6

I'll show here one benefit of a windowed design and a trick to get the same benefit from Parks–McClellan. For half-band, quarter-band etc. filters windowing retains the time-domain zeros of the scaled sinc function, which is the prototypical ideal low-pass filter. The zeros end up in the coefficients, reducing the computational cost of the filters. For a ...


6

Lets say we want to transmit a sequence of discrete data $\left\lbrace x[n] \right\rbrace$. But because we are living in analog world, the sequence must be modulated. Call $T_s$ is symbol duration and use a set of orthonormal waveforms $\left\lbrace p_n(t) = p(t-nT_s), n \in \mathbb{Z} \right\rbrace$, (baseband) signal $x(t)$ can be written as \begin{...


6

There are several reasons why the two results don't match: the coefficients of the FIR Hilbert transformer are wrong the FIR Hilbert transformer is too short to even come close to the performance of the FFT-based implementation the frequency of the input signal is too low for the FIR Hilbert transformer to perform properly. A FIR Hilbert transformer always ...


6

A causal first-order IIR filter is characterized by the following difference equation: $$y[n]=b_0x[n]+b_1x[n-1]-a_1y[n-1]\tag{1}$$ with $x[n]$ the input signal, and $y[n]$ the output signal. The impulse response of that system can be computed via the $\mathcal{Z}$-transform or otherwise, and it turns out to be $$h[n]=b_0\delta[n]+(-a_1)^{n-1}(b_1-b_0a_1)u[...


5

To be precise the group delay of a linear phase FIR filter is $(N-1)/2$ samples, where $N$ is the filter length (i.e. the number of taps). The group delay is constant for all frequencies, because the filter has a linear phase, i.e. its impulse response is symmetrical (or asymmetric). A linear phase means that all frequency components of the input signal ...


5

Yes, you can interpolate and decimate at the same time. This is called "resampling". If you google resampling you will find lots of information about it. And yes, your reasoning about resampling is mostly correct. When thinking about resampling theoretically you usually put the interpolation first to avoid Nyquist issues. An interpolator is upsampling ...


5

These are just different ways to implement FIR filters. In theory these structures are all equivalent in the sense that they compute exactly the same output signal for a given input signal (under ideal circumstances, i.e., infinite precision), but in practice they behave differently. The differences are mainly the following: their behavior when implemented ...


5

This is an approximation, but you can make it as good as you like.


5

Given that $$ u[n-k_1] = \sum_{k=k_1}^\infty \delta[n-k] $$ you can take the difference between two steps with different shifts ($k_1 < k_2$) and obtain: $$ u[n-k_1] - u[n-k_2] = \sum_{k=k_1}^{k_2-1} \delta[n-k] $$ Then the difference $$ 3u[n-2] - 3u[n-6] = 3\left(\delta[n-2] + \delta[n-3] + \delta[n-4] + \delta[n-5]\right) $$ which appears in ...


5

Yes this would properly delay the input by 64 samples but note that you can simply do: $out[n]=in[n-64]$ Which was probably clear to you and you just wanted to show how it related to a 65 tap FIR with all taps = 0 except the last one. The coefficients of the FIR filter represent the impulse response (strictly in discrete terms we call this the "unit ...


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