# Tag Info

12

FFT -> zeroing coefficients -> IFFT is not the correct way of doing filtering - the actual filter realized by doing so has poor characteristics. The correct way of filtering signals is to compute the coefficients of a digital filter, a process known as filter design and for which a large body of software tools/documentation is available, and apply it to ...

8

The best way to apply frequency domain filtering for signal streams is overlap add (or related flavors overlap save, or block convolvers, etc.). You basically take in one frame at a time (say 1024 samples). Zero pad to twice the length (2048), do an FFT, multiply with (also zero padded) transfer function of the filter, do an inverse FFT. Save the last 1024 ...

8

The result will indeed be a high pass filter. From your difference equation, the transfer function of the low pass filter is $$H_l(z)=\frac{\beta}{1-(1-\beta)z^{-1}}\tag{1}$$ with $\beta=1/\alpha$. Note that this is actually a leaky integrator, not a classic low pass filter, because its frequency response does not have a zero at Nyquist. The high pass ...

8

In general you can't simply subtract a low-pass filtered version of a signal from the original one to obtain a high-pass filtered signal. The reason is as follows. What you're actually doing is implement a system with frequency response $$H(\omega)=1-H_{LP}(\omega)\tag{1}$$ where $H_{LP}(\omega)$ is the frequency response of the low-pass filter. Note that ... 7 A high pass filter will remove a large portion to all of the 0 Hz component or DC offset from a signal. That's similar to subtracting the mean average, which for a normally distributed signal will make around half of the signal negative (since it was below the original average mean). If you want the mean to be the same after a high pass filter, you could ... 7 In theory you can do this, but in practice it is difficult to do because the time and phase alignment must be pretty good for it to work. If the alignment is good you will get the destructive interference that you are seeking. If they aren't, you will get some constructive interference. Even worse, whether they are destructively or constructively ... 7 In thes$-domain, the LPF-to-BPF transformation doubles the order of the filter. that is because the LPF has one transition from passband to stopband, but the BPF has two such transitions. Remember that when we do frequency response, we substitute$s=j\omega$. That is, we evaluate the$s$-plane transfer function$H(s)$as$H(j\omega)$. The magnitude of$...

6

The frequency response of the two complementary filters are $H_2(e^{j\theta}) = 1 - H_1(e^{j\theta})$, or the impulse responses $h_2[n] = \delta[n] - h_1[n]$. For an IIR filter, $H_1(z)$ can be written as $\frac{b_0 + b_1 z^{-1} + \ldots}{a_0 + a_1 z^{-1} + \ldots}$. Then $H_2(z)$ should be something like $\frac{(a_0 - b_0) + (a_1 - b_1) z^{-1} + \ldots}{... 6 Attenuation in this context refers to a reduction in amplitude of some signal component as it passes through a system (in your case, the system being the highpass filter. Linear filters are designed to pass certain frequency components while stopping (or attenuating) others. As the name implies, a highpass filter is designed to pass high-frequency content ... 6 A high pass filter has some properties that are similar to taking a derivative. The derivative of a function that is always positive will be negative wherever the slope is negative. There's nothing you can do about it. For example, take the function$f(t) = 400 + \sin \omega t$. This wiggles around between 399 and 401 (very positive), yet the derivative ... 6 The input to your filter is essentially a step function (since it has value 0 prior to t = 0, and a positive value for t > 0), so you see the step response of the filter, hence the initial ringing. This is expected behaviour, and after a suitable amount of time the step response will have settled to zero. 5 This is a first order, low pass infinite impulse response filter (IIR). It is some times called the exponentially weighted moving average. You can find the derivation on Wikipedia. Orfanidis' Introduction to Signal Processing gives a nice description as well. Don't think of it as high passing y and low passing x, this will lead to confusion. It is ... 5 That depends on the definition of high-pass filter. If you define a high-pass filter as a filter that has high response in the high frequencies in frequency domain, then the easiest way is to take a look at the magnitude of Fourier transform, (by definition). Applying Fourier transform (in Matlab) A = fftshift(abs(fft2(padarray([-1 -1 -1; 0 0 0; 1 1 1],[... 4 Consider this filter in 1D (for the sake of simplicity): [-1 1 0] This filter responds to pixel differences, i.e. edges (left pixel * (-1) + center pixel * 1 + right pixel * 0) which is (center pixel - left pixel). Response of this filter is positive on rising edges and negative on falling edges. The filter is not symmetric and hence it will "shift" the ... 4 You're probably best off asking your professor for clarification. As you reasoned, it sounds like you're being asked to multiply the image in the frequency domain by either a rectangular or circular mask that eliminates all frequencies outside the mask. This is not typically how you would apply a filter, however, as "ideal" frequency-domain filter masks have ... 4 You can design the different filter types directly with the scipy.signal functions. There are three main functions for creating finite impulse response filters with the scipy.signal package. signal.remez signal.firwin signal.firwin2 The remez function, as arguments, takes the number of taps (order+1), the "bands", and the "desired" gain. The "bands" is ... 4 For an LTI system another method to generate a highpass filter impulse response$h_{hp}[n]$, from an existing lowpass filter impulse reponse$h_{lp}[n]$is the following: $$h_{high}[n]=(-1)^n h_{low}[n]$$ From the DTFT properties we can see that: $$h_{high}[n]=e^{j\pi n} h_{low}[n]$$ $$H_{high}(e^{j\omega})=H_{low}(e^{j(\omega - \pi)})$$ which would ... 4 This is a first-order discrete-time Butterworth filter, which can be obtained via the bilinear transform from the following analog prototype filter (with normalized cut-off frequency): $$H(s)=\frac{s}{1+s}\tag{1}$$ The bilinear transform replaces$s$by$k\frac{z-1}{z+1}$, where$k$is chosen such that the discrete-time filter has the specified cut-off ... 4 Note that the pole locations would be the same for all$4$classic types of frequency-selective filters (low pass, high pass, band pass, band stop). It's the location of the zeros that determines which filter type it is. Since we don't see any zeros, we can assume that they are at infinity, hence, the filter is a low pass filter. For a high pass filter you ... 4 They are both highpass type filters, but used with very different intentions. One should immediately observe the fundamental difference that the output of unsharp masking filter is an enhanced image to be viewed by humans, whereas the output of the Sobel (edge detector) filter is not an image to be viewed by humans, but rather a description of the edges to ... 3 If the DFT is the Uniform sampling from$ 0 $to$ 2 \pi $then the first bin is given by: $$x[k] = \sum_{n = 0}^{N - 1} x[n]$$ Namely it is the sum of all the samples. Hence in order to remove the DC (Mean) all you need is a filter which has zero in its DC bin. Since, the filtered signal, which is a convolution (Circular) of the DFT of the input signal ... 3 Juancho's answer is sort of right, however there is one problem: The complimentary filter of a low pass is generally NOT a high pass filter, at least not in the sense that you are looking for. For example the one's compliment of a 4th order Butterworth low pass does not look like a 4th order high pass filter at all. It has about only half the steepness, ... 3 You indicated that you're having trouble figuring out how to design a suitable highpass filter. One method is to first design a lowpass filter prototype, then apply a transform that warps the filter's response into a filter of another type (such as a highpass or bandpass filter). This is done by substituting an expression for$z^{-1}$into the transfer ... 3 If you want to detect the peak value of the time-domain signal, it is important not to change phase of each frequency signals. Otherwise, the peak value will be affected by it and will slightly change. I think you already have recorded signal and you can process it after the recording. If so, it is better to use zero-phased filters, like this function in ... 3 Regarding scaling: If you sum up the coefficients, you get the magnitude for DC. Hence, it makes sense that you get those numbers ($\approx 1$for LP,$\approx 0\$ for HP). In addition to Matt L.'s excellent answer one can just point out that what he is using is referred to as magnitude complementary filters, which is the common case for linear-phase FIR ...

3

I agree that a large-order (12 taps+) high-pass Butterworth filter will be sufficient. Why? Well, Butterworth filters are commonly used in professional audio-editing applications to do filtering, because their frequency response is designed to be as flat as possible in the passband. This means that the filtered audio is of higher quality/fidelity, as ...

3

out[i] = out[i-1] + (alpha*(in[i] - out[i-1])); From Wikipedia's article on Low pass filters: That is, this discrete-time implementation of a simple RC low-pass filter is the exponentially weighted moving average […] The loop that calculates each of the n outputs can be refactored into the equivalent: for i from 1 to n y[i] := y[i-1] + α *...

3

In addition to @MarcusMüller answer, you can find other names and historical details on this type of filter in Is there a technical term for this simple method of smoothing out a signal?. I will not rewrite the other answer, just give here a few aspects: This filter is so useful and common that its has several names, for instance first order exponential ...

3

Today I received an answer from the authors of the book. It turns out that figure 1.7a was wrong, and they sent me the updated one. The corrected diagram will be added in this Summer's update!

3

Filters generally can't just have a single cut-off frequency (otherwise their complexity will be huge). So a transition region is usually needed. In this case, the filter_stop_freq is that frequency below which the filter MUST act like a stop filter and filter_pass_freq is that frequency above which the filter MUST act like a pass filter. The frequencies ...

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