40

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 ...


31

The moving average filter (sometimes known colloquially as a boxcar filter) has a rectangular impulse response: $$ h[n] = \frac{1}{N}\sum_{k=0}^{N-1} \delta[n-k] $$ Or, stated differently: $$ h[n] = \begin{cases} \frac{1}{N}, && 0 \le n < N \\ 0, && \text{otherwise} \end{cases} $$ Remembering that a discrete-time system's frequency ...


28

When choosing one of these 4 types of linear phase filters there are mainly 3 things to consider: constraints on the zeros of $H(z)$ at $z=1$ and $z=-1$ integer/non-integer group delay phase shift (apart from the linear phase) For type I filters (odd number of taps, even symmetry) there are no constraints on the zeros at $z=1$ and $z=-1$, the phase shift ...


26

Let me add the following graphic to the great answers already given, with the intention of a specific and clear answer to the question posed. The other answers detail what linear phase is, this details why it is important in one graphic: When a filter has linear phase, then all the frequencies within that signal will be delayed the same amount in time (as ...


24

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 ...


23

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 ...


21

FIR filters contain as many poles as they have zeros. but all of the poles are located at the origin, $z=0$. because all of the poles are located inside the unit circle, the FIR filter is ostensibly stable. this is probably not the FIR filter the OP is thinking about, but there is a class of FIR filters called Truncated IIR filters (TIIR) which may have a ...


16

If $N$ is the length of the moving average, then an approximate cut-off frequency $F_{co}$ (valid for $N >= 2$) in normalized frequency $F=f/fs$ is: $F_{co} = \frac {0.442947} {\sqrt{N^2-1}}$ The inverse of this is $N = \frac {\sqrt{0.196202 + F_{co}^2}}{F_{co}}$ This formula is asymptotically correct for large N, and has about 2% error for N=2, and ...


16

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 ...


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 ...


15

"Can you mathematically show that FIR filters have poles, because I'm not seeing it." – Jim Clay can we assume this FIR is causal? filter order is $N$. number of taps is $N+1$ the Finite Impulse Response: $ \quad h[n] = 0 \quad \forall \quad n>N, \ n<0$ transfer function of the FIR: $$ \begin{align} H(z) & = \sum_{n=-\infty}^{+\infty} h[n] ...


15

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,...


13

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 ...


13

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_{...


12

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 ...


11

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}^{\...


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 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^{\...


9

FIR filters contain only zeros and no poles. If a filter contains poles, it is IIR. IIR filters are indeed afflicted with stability issues and must be handled with care. EDIT: After some further thought and some scribbling and google-ing, I think that I have an answer to this question of FIR poles that hopefully will be satisfactory to interested parties....


9

Consider a zero-phase moving average of length $N$: $$\text{y}[n] = \begin{cases} \displaystyle\frac{\text{x}[n] + \displaystyle\sum_{k=1}^{\frac{N-1}{2}}\left(\text{x}[n+k] + \text{x}[n-k]\right)}{N},&n\in\mathbb{Z}&\text{for }N\text{ odd}\\ \displaystyle\frac{\displaystyle\sum_{k=1}^{\frac{N}{2}}\left(\text{x}[n+(k-\frac{1}{2})] + \text{x}[n-(k-\...


9

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 management is done). Arithmetic operation translates into clock cycles of your processor. That depends a lot on the efficiency of your instruction set and how good yo ...


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

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 ...


7

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. This means that the resulting FIR filter approximates the magnitude and the phase characteristic of the original IIR filter. So with this approach the phase will ...


7

The unit circle on the z-plane represents the frequency axis, similar to the imaginary axis $j\Omega$ on the s-plane for the Laplace Transform in the continuous time case. So the frequency response of the system is given by $H(z)$ when $z= e^{j\omega}$ with $\omega$ going from $0$ to $2\pi$ representing the normalized fractional radian frequency (which is ...


6

As pointed out by niaren, you have to multiply by two, but this also means that your whole magnitude response is shifted up by 6dB, also in the stopbands. So you will have 6dB less stopband attenuation. Of course, the attenuation relative to the passband gain remains constant. You have to take this into account when designing your filter. Say you need 60dB ...


6

If the Z-transform of the feedforward section is divisible by the Z-transform of the feedback section, the filter is FIR. Consider your example: $y[n] = y[n-1] + x[n] - x[n-3]$. The Z-transform is $\mathrm Y(z)- z^{-1}\mathrm Y(z) = \mathrm X(z) - z^{-3}\mathrm X(z)$, and the Z-transform of the response is $\mathrm H(z) = \mathrm Y(z)/\mathrm X(z) = (1 - z^...


6

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 ...


6

The first basic test could be to use a unit impulse as an input signal and see if the output signal equals the impulse response (i.e. the filter coefficients). Another simple test signal is a unit step. The corresponding output should be the cumulative sum of the filter's impulse response, i.e. for $x[n]=u[n]$, the output must be $$y[n]=\sum_{k=0}^nh[k],\...


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)$. ...


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