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

Tag Info

Hot answers tagged filtering

17

To understand the linearity property more easily.Let us consider the above diagram,here we have 2 sequences namely Xn and Yn. when we add both the sequence we get Xn+Yn whose amplitude value are represented with blue colour. when any system which satisfy this condition then it is called linear. In case of mean filter, mean value for sequence Xn is 1+1+3/3=5/...

16

Nonlinear filters are those for which the linearity relationship breaks down. Consider two signals $A$ and $B$, for linear filter such as mean filter $F_m$,you have $F_m(A+\lambda B) = F_m(A) + \lambda F_m(B)$, but the equation is not satisfied for an nonlinear filter such as the median filter. In application, the median filter removes outliers and shot ...

15

I agree with pichenettes's answer but I would like to add that it is pretty common practice to use a simple inexpensive low-order analog anti-aliasing filter, and do the rest of the anti-aliasing filtering in the digital domain. This implies of course that you do not process at maximum sampling rate but that you downsample after the digital anti-aliasing ...

14

No, this does not make sense. Say your ADC sample rate is 1kHz. A 100 Hz sine wave and a 900 Hz sine wave will yield exactly the same sequence of digital samples once fed into your ADC - but you want to pass the former and attenuate the later. How do you expect your digital filter to produce different outputs when fed the same input? The only thing that ...

12

One approach would be to cast the problem as least-squares smoothing. The idea is to locally fit a polynomial with a moving window, then evaluate the derivative of the polynomial. This answer about Savitzky-Golay filtering has some theoretical background on how it works for nonuniform sampling. In this case, code is probably more illuminating as to the ...

9

The problem with the moving average is that the average is not robust to the presence of the outliers - so you would need a very large window size to "dilute" the outliers. Try a non-linear filter instead, like a median filter: Apply a median filter on your signal - you would need a window size of at least 300 samples. Compute the difference between the ...

9

Just to support Matt's answer and provide a few more details: Most modern ADCs do most of the hard antialiasing job in the digital domain. Reason is that digital filters tend to produce less by-products for a much lower cost. The actual chain is: Analog Input. Analog Anti-aliasing filter. Oversampling (eg, at 8x). Digital Anti-Aliasing Filter. Decimating (...

8

Linear filters in the spatial domain have a direct equivalent in the frequency domain, so you can transform your data and filter between spatial<->frequency domains and get equivalent results. However the transforms that we use for converting between spatial<->frequency domains are only valid for linear systems - a non-linear filter such as a median ...

8

For a start, any non-linear system will not have an easily-identifiable frequency response. So, it's really a nonsensical question. I intend no offense; nonsensical questions are often the most enlightening! However one way to try to answer your question is to assume that the LTI filter involved is the mean (rather than the median) of the windowed data. ...

8

Yes, you are correct. Multiplication in time domain means convolution in frequency domain and vice versa. Multiplying your signals $x[n]$ and $y[n]$ will give an output: \begin{align} z[n]&=\{2\cdot 5, 4\cdot 1, 1\cdot 8\}\\ &= \{10, 4, 8\}\end{align} Remember that this output is in time domain. When you convolve $x[n]$ and $y[n]$, you will get $... 7 Your first order filter recursion for some real constants$a,b,c$is $$y[n] = a x[n] + b x[n-1] - c y[n-1]$$ with the two initial memory states$x[-1]$and$y[-1]$at$n=0$. Your "no transient" condition can be translated to$y=0$and a necessary second condition so that you can solve for both of your memory states. The second condition could be, ... 6 I'm pretty new to this myself, so please correct me if I get this wrong. Using your example, J = ordfilt2(I, 9, true(5)). ordfilt2 will move over the 2d array I in blocks of the same size as true(5). For each of these 5x5 blocks, sort all the elements from smallest to largest. Now fill in the corresponding block in J with a bunch of copies of the 9th ... 5 You are looking at the wrong metric of "correctness". Nearest neighbor is introducing significant discontinuities that are showing up as massive quantities of noise in the result. The problem is that you should be comparing to the result you would have gotten if you had sampled at 26.25MHz in the first place. Let's try it (sample a 12Hz sine wave at 26 Hz ... 5 In previous sections of the book, the fact that a discrete-time signal's spectrum is periodic may have been mentioned. It can be described formally as follows: $$X(e^{j\omega})=\frac1{T} \sum_{k=-\infty}^{\infty}X_C\biggr(j\biggr(\frac{\omega}{T}-\frac{2\pi k}{T}\biggr)\biggr)$$ being$X_C(j\omega)$the Fourier Transform of the continuous signal, and$T=1/...

5

You can achieve this result by using two combs filters : https://en.wikipedia.org/wiki/Comb_filter Put simply, the comb filter consists of adding a delayed version of the signal to itself, causing destructive or constructive interference. For instance, with $K = 20$ and a negative gain value after the delay line, you can significantly decrease or suppress ...

4

A filter bank is a collection of bandpass filters designed to split a signal into a number of bands. The centre frequencies of the band pass filters can be spaced linearly or according to a non-linear spacing depending on the intended application. $H(z)$ denotes the $z$-domain transfer function of a filter in the bank.

4

You can design that filter manually without problems. Matlab just uses a very simplistic approach to comb filtering with a delay line. In order to keeps things as simple as possible I would recommend you use a series of notch filters to remove each partial of your harmonic noise separately. That also gives you more control over how much of each harmonic ...

4

In a linear filter, the output will change linearly with a change in the input. You could plot some sort of straight line from the relationship between the two. A median filter can change non-linearly with certain input changes. e.g. take an input vector where all the data values are different: a change in a non-middle value won't affect the median output ...

4

A finite impulse response (FIR) digital filter implements the following convolution sum $$y(n)=\sum_{n=0}^{N-1}h(k)x(n-k)\tag{1}$$ for each output sample $y(n)$, where $x(n)$ is the discrete-time input signal, $h(n)$ is the filter's impulse response, and $N$ is the filter length. The values $h(n)$ are also called filter taps, and $N$ is then referred to as ...

4

In Short: The order does matter. Detailed: Downsampling by a factor of 2 without filtering, will cause aliasing in frequencies of 500Hz and more. Since your signal is bandlimited to 600Hz, the frequency range of 400Hz-500Hz will be corrupted. So (theoretically) the frequency range 0Hz-400Hz will be the same with or without filtering. If you were only ...

4

Yes, the order does matter. In a real system with noise (as opposed to an idealized model) if you decimate before filtering, all the noise in the bands you aren't interested in will alias back in, raising the noise floor of your system. In your example, if you downsample by two before filtering you would have twice the noise in your bands of interest ...

4

In general it's only possible to implement causal and stable filters. There are exceptions where marginally stable filters are used, but this doesn't apply here. So if you want to invert a given filter, this is only possible if its zeros are inside the unit circle of the complex plane (such filters are called minimum-phase filters). The zeros of the given ...

4

I need to preprocess raw ecg data in R, here is a sample already standardized. I'm not an expert in signal processing nor experienced in working with medical data,... Not being an expert on how the heart works and how its phases manifest themselves on the ElectroCardioGram (ECG) is not a problem. But it would help immensely if you mentioned what is the ...

4

A first order lowpass filter is usually implemented like this: $$p[n] = \alpha p[n-1] + (1-\alpha) pi[n]$$ Where $p[n]$ is your filtered power estimation, $p[n-1]$ is the previous result, $pi[n]$ is your new measurement (probably the product of instantaneous voltage and current measurements), and $\alpha$ is a positive parameter just less than 1. The ...

4

Sampling at a higher rate will distribute the quantization noise over a wider frequency, thus reducing the noise spectral density due to that quantization noise, with a lot of caveats. For more details on that see What are advantages of having higher sampling rate of a signal? In your last paragraph, if you are referring to running the same filter at a ...

4

Yes, integration and differentiation can be linear filters. You can start from laplace properties that say: $\int_{0}^{t} {x(t)dt} \longrightarrow \frac{X(s)}{s} \\ \frac{d}{dt}x(t) \longrightarrow sX(s)$ So you can find transfer function of integration and differentiation: $H_{INT}(s) = \frac{1}{s} \\ H_{DIFF}(s)=s$ You can convert these transfer ...

3

Wavelets are ideal for localized events. The Fourier Transform represents a function as a sum of sines and cosines, neither of which are localized. The spectrogram does keep some time information, at the expense of frequency resolution In your case, the signal is not localized at all. The spectrogram smears your 15 Hz band over several Hz, as it captures ...

3

Using the diff approach, you could correct big positive changes and big negative changes separately, i.e. drop the condition that the second has to follow the first immediately. Compute the diff, detect outliers using a threshold, replace them by zero or by the mean of the non-outlier differences, compute the cumulative sum of the differences. The result ...

3

The traditional overlap-add technique cannot be used as is in musical applications (reverberation) where latency is critical. It is a common practice to break down the impulse response into non-uniform chunks, and to run in parallel different convolvers for each segment of the impulse response - some of them being naive FIR implementations (for the short ...

3

Output the first M samples of your convolution result Keep the remaining samples and ADD those to the result next buffer Google "overlap add" for more information. While overlap add is a frequency domain method, it explains the framing and buffer handling well.

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