The Stack Overflow podcast is back! Listen to an interview with our new CEO.

# Tag Info

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

26

This is the classic problem of speech detection. First thing to do would be to Google the concept. It is widely used in digital communication and there's been a lot of research conducted on the subject and there are good papers out there. Generally, the more background noise you have to deal with the more elaborate your method of speech detection must be. ...

26

What you really want to do is essentially called as Voice Activity Detection or speech detection. Basically any pure speech signal (which contains no music) has three parts. The voiced sound - which is basically caused by Vowels The unvoiced sound - which contains consonants. The characteristic of human sound is such that while a lot of energy is used ...

26

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

25

We know that in general transfer function of a filter is given by: $$H(z)=\dfrac{\sum_{k=0}^{M}b_kz^{-k}}{\sum_{k=0}^{N}a_kz^{-k}}$$ Now substitute $z=e^{j\omega}$ to evaluate the transfer function on the unit circle: $$H(e^{j\omega})=\dfrac{\sum_{k=0}^{M}b_ke^{-j\omega k}}{\sum_{k=0}^{N}a_ke^{-j\omega k}}$$ Thus this becomes only a problem of ...

23

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

19

The frequency response for the filter designed using the butter function is: But there is no reason to limit the filter to a constant monotonic filter design. If you desire a higher attenuation in the stopband and steeper transition band, other options exist. For more information on specifying a filter using iirdesing see this. As shown by the frequency ...

18

The relation of "minimum" to "phase" in a minimum phase system or filter can be seen if you plot the unwrapped phase against frequency. You can use a pole zero diagram of the system response to help do a incremental graphical plot of the frequency response and phase angle. This method helps in doing a phase plot without phase wrapping discontinuities. ...

18

There are a lot of books out there, but if you are interested in Control and Signal Processing, I strongly suggest you take a look a Stephen Boyd Lectures from standford: http://www.youtube.com/watch?v=bf1264iFr-w There's the first one, the entire course is really valuable and he is a great Teacher. Appart from That here's a good list of my preferred ...

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

16

There's a nice discussion of this problem in Embedded Signal Processing with the Micro Signal Architecture, roughly between pages 63 and 69. On page 63, it includes a derivation of the exact recursive moving average filter (which niaren gave in his answer), $$H(z) = { 1 \over{N} } { 1 - z^{-N} \over { 1 - z^{-1} } }.$$ For convenience with respect to ...

16

OK, let's try to derive the best: $$\begin{array}{lcl} y[n] &=& \alpha x[n] + (1 - \alpha) y[n - 1] \\ &=& \alpha x[n] + (1 - \alpha) \alpha x[n-1] + (1 - \alpha)^2 y[n - 2]\\ &=& \alpha x[n] + (1 - \alpha) \alpha x[n-1] + (1 - \alpha)^2 \alpha x[n-2] + (1 - \alpha)^3 y[n - 3]\\ \end{array}$$ so that the coefficient of $x[n-m]$ is ...

16

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

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

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

If you want the gain of your length-$N$ filter to be unity at a particular frequency, then you can calculate it directly: $$G = \sum_{k=0}^{N-1} h[k] e^{-j\omega k}$$ $G$ gives the gain of your filter at the frequency $\omega \in [0, 2\pi)$. If you would like to normalize the filter so that its gain at that frequency is $1$, then divide all of the filter ...

14

this is just an addendum to jojek's answer which is more general and perfectly good when double-precision math is used. when there is less precision, there is a "cosine problem" that crops up when either the frequency in the frequency response is very low (much lower than Nyquist) and also when the resonant frequencies of the filter are very low. when you ...

13

It's the last thing you said ("Or does the output of the first filter feed as x_in in to the second filter and so on?"). The idea is simple: you treat the biquads as separate second-order filters that are in cascade. The output from the first filter is the input to the second, and so on, so the delay lines are spread out among the filters. If you need to ...

13

This is only a partial answer, but there's a lecture online where Hamming talks about how he came up with his eponymous window. Starting at roughly 15:15 gives the full context. With a reasonably entertaining story, he credits John Tukey with inventing the theory of windows (for spectrum analysis). However, he introduces the whole subject in the context of ...

13

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

Windowing is used because the DFT calculations operate on the infinite periodic extension of the input signal. Since many actual signals are either not periodic at all, or are sampled over an interval different from their actual period, this can produce false frequency components at the artificial 'edge' between repeated intervals, called leakage. By first ...

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 filter in your example is a first-order infinite impulse response (IIR) filter. Its transfer function is: $$H(z) = \frac{1 - \alpha}{1 - \alpha z^{-1}}$$ which corresponds to a difference equation of: $$y[n] = \alpha y[n-1] + (1-\alpha) x[n]$$ where $x[n]$ is the filter input and $y[n]$ is the filter output. This type of filter is often used as ...

11

There is an open-source implementation of Parks-McClellan (also known as the Remez exchange algorithm) in GNU Octave, a free-software implementation of a MATLAB-like environment. The function, called "remez", is contained in the "signal" package, which is hosted at Octave-Forge. If you download the package, you'll find "remez.cc", a C++ implementation of the ...

11

You can derive the expression for the coefficients by doing bilinear transformation of the following analog low-pass prototype filter $$H(s) = \frac{w_0^2}{s^2 + (w_0/Q)s + w_0^2}$$ where $w_0$ is the cut-off frequency. You can lookup the bilinear transformation on Wikipedia. The filter used in the Android app is a Butterworth filter because the chosen ...

11

I think you are confusing two different operations. Windowing in the time domain is explained by @sam, so I won't repeat that. But windowing is not done to perform filtering. Filtering by multiplying the FFT of a signal by the filter frequency response is entirely reasonable in many situations, and is indeed done. The alternative for filtering is time-...

11

There have been several good answers to this question. However, I feel that one important point has not been made entirely clear. One part of the question was why we don't just multiply the FFT of a signal with the desired filter response. E.g., if we want to lowpass filter our signal, we could simply zero all frequency components higher than the desired cut-...

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

10

All digital filter frequency parameters (passband begin frequency, passband end frequency, and stopband begin frequency) are stated in terms of an input signal sequence's Fs sampling frequency. For a lowpass filter example, if I said a lowpass filter's passband width (it's "cutoff" frequency) is 0.2, I'm saying that the cutoff frequency is 0.2 times Fs. So ...

10

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

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