19

You could use a 2nd order IIR notch filter as I describe in this post Transfer function of second order notch filter - That post demonstrates a 50 Hz IIR notch with 1 KHz sampling. [Update: As @user47050 astutely points out in the comments, the IIR notch would also have minimal delay regardless of notch bandwidth, since the dominat delay in the IIR notch ...


9

This is an uncertainty principle kind of problem: there is no way to make a reliable filter with little delay that will suppress a narrow band around 50Hz since the narrowness of a criterion in frequency space necessitates a certain width of observation in the time domain. Basically the compactness of a phenomenon in time and in frequency cannot be ...


5

The Jacobian is not computed numerically but analytically and then just evaluated. The frequency response of the IIR filter is $$H(e^{j\omega})=\frac{b_0+b_1e^{-j\omega}+\ldots+b_Me^{-jM\omega}}{1+a_1e^{-j\omega}+\ldots+a_Ne^{-jN\omega}}=\frac{B(e^{j\omega})}{A(e^{j\omega})}\tag{1}$$ Now you need the derivative with respect to the filter coefficients: $$\...


5

First of all, what is the order of your IIR filter? The highest order I have ever used was an order-10 IIR filter for a control loop application. I feel like it is unlikely that you need more that this. Second, it is a good idea to split your filter in second-order-sections (SOS) and cascade them , this usually fix most issues. https://www.dsprelated.com/...


5

I joined this community only to answer your question as I had a similar problem about 2 years ago, in ECG domain though. What I've found (unfortunately I cannot trace the source back) is a very simple solution for a digital notch filter of taking the signal delayed by half of the period of the frequency you want to filter out and get the average of it with ...


4

Approximation by the real part of a weighted sum of separable complex Gaussian component kernels Figure 1. The proposed scheme illustrated as 1-d real convolutions ($*$) and additions ($+$), for cut-off frequency $\omega_c = \pi/4$ and kernel width $N=41$. Each the upper and the lower half of the diagram is equivalent to taking the real part of a 1-d ...


4

Limited numerical precision. The higher the sample rate, the closer the poles move to the unit circle, the closer to the unit circle, the less stable the filter is. There are different implementation methods that are better than others: design as poles, and zeros and not as transfer function, use cascaded second order sections, use correct section ordering, ...


4

I assume this a for real-time processing. Otherwise, you could simply discard the number of samples corresponding to the group delay. 1st solution - Use an IIR notch filter. You could use this solution Analytically designing a notch-filter for specified frequency 50 Hz The group delay will be minimal, probably negligible, if you're not close to 50 Hz. ...


3

Questioner's answer... sigma have the same units as x and y i.e. number of pixels. In multi-scale filtering, the size of the filter must change when the sigma changes. Obtain the number of pixels per one millimeter or the vice-versa. (I did this using the property of pixel spacing included in the DICOM metadata in Matlab you can do this as info=dicominfo('...


3

Given your hardware constrains mentioned in the comments, your best shot is probably to do this as parallel second order section. Since the parallel sections are independent of each other, it's pretty straight forward to vectorize and it's also a little cheaper: each section has a complex conjugate pole pair but only one real zero. Things get a bit more ...


3

Assuming: That you limit yourself to LTI filters. That you can characterize both the noise and the signal of interest. Then: (a) If you want to detect a signal of interest (e.g. detect footsteps), use a matched filter. (b) If you want to estimate the value of such signal, use a Wiener filter. These are "the best" you can do (under a bunch of assumptions)....


3

I've seen Julius' MATLAB code and I know what it does. Essentially, given an LTI filter with impulse response, $h[n]$, and frequency response: $$\begin{align} H(e^{j \omega}) &\triangleq \Big| H(e^{j \omega}) \Big| \, e^{j \phi(\omega) } \\ &= \sum\limits_{n=-\infty}^{\infty} h[n] \, e^{-j \omega n} \end{align}$$ Then $\Big| H(e^{j \omega}) \Big| ...


3

First of all, it's not correct to say "poles should (always) be inside the unit circle for an LTI system to be stable" ; unless it's implied that system is also causal. Otherwise, if the system is noncausal, then its poles should be outside of unit circle for the system being stable. For IIR systems that are described by LCCDEs causality must be externally ...


3

In general, there is no such requirement for notch filters that $H(e^{j0})=H(e^{j\pi})$ must be satisfied. You could definitely have a notch filter with $H(e^{j0})\neq H(e^{j\pi})$. Having the same gain at DC and at Nyquist is just a practical definition, and if you have a sufficient number of degrees of freedom (i.e., filter coefficients) you might as well ...


3

In support of Comparable mixin, a default <=> or spaceship operator for pixels is defined in the function Pixel_spaceship in rmpixel.c. However, in your use of the sort method, you define your own code block that overrides the <=> operator, and yours takes a single argument rather than two which would be correct, so the definition is broken and ...


3

Ripples are usually an undesired side effect. E.g., when designing a frequency selective filter you normally want a piecewise constant magnitude of the frequency response, but this is physically impossible. Certain design criteria result in filters without ripples, such as the Butterworth criterion, which results in filters with a maximally flat response.


3

This happens frequently if your poles are reasonably close to the unit circle. Consider the following example %% TF2ZP is problematic fs = 44100; % 6th order lowpass, fc = 50Hz, sampled at 44.1kHz [z,p,k] = cheby2(6,80,50*2/fs); % to transfer function [b,a] = zp2tf(z,p,k); % back to zpk [z1,p1,k1] = tf2zp(b,a); display([p p1]); Displaying the poles side ...


3

It is better to "parse" these networks from the output back towards the input, calling their input some general $x$ and performing substitutions and/or compositions. So, let's call these networks $U$pper and $L$ower. From the upper diagram: $$UH_2[n] = x[n] + x[n-1] \cdot -a_1$$ and $$UH_1[n] = x[n] \cdot b_0+x[n-1] \cdot b_1$$ Now, the output of $U$...


3

Actual channels are always causal (like everything else in the physical universe). Actual (discrete-time) channels also sometimes have one tap that is considerably larger than the rest; an example impulse response would be h = [0.1, 1.5, 0.2]. Some authors prefer to define h[0] as the largest tap; in my example, we'd have h[-1] = 0.1, h[0] = 1.5, and h[1] = ...


3

It is common in DSP practice to define some convenient center for a filter as being at time 0, even though we cannot build non-causal systems in practice. You see this most when you're designing a symmetrical filter, and you define t = 0 as the filter center, but it happens elsewhere. You do this because it makes the analysis easier, and you justify it by ...


2

Consider a moving average over N samples- this is a simple FIR filter where each new output is the average of the past N samples. It is easy to see how high frequency noise can be filtered out (so is a low pass filter), and the longer time duration we include in the averaging window the lower will be the frequency cut off (just compare a stock market 30 day ...


2

I would recommendate the lib NWaves, not so mature, but enough for most of cases in life.


2

The most straightforward way to impose constraints in the frequency domain as well as in the time domain for the design of (linear phase) FIR filters is to use linear programming. Constraints on the step response or on the impulse response are naturally linear, and constraints on the frequency response can also be formulated as linear constraints in the ...


2

Apart from the method operating on the cepstrum suggested in hotpaw2's answer, there is the obvious way of reflecting the zeros outside the unit circle into the unit circle by keeping their angle unchanged and inverting their magnitude. So each zero $z_0$ with $|z_0|>1$ needs to be replaced by $1/z_0^*$, where $*$ denotes complex conjugation. You also ...


2

Fixed point processing is very difficult. Floating point is A LOT easier. The best algorithm and scaling approach depends a lot on your specific filter and the statistics of your signal. There is no "one size fits all" solution. Cascaded second order sections are almost always the way to go. Primarily they guarantee that your coefficients values are bounded ...


2

The advantage of a RRC filter with a smaller span is that it has fewer taps, so the filter requires fewer multiplies and additions per sample. Longer filters approximate the ideal RRC response more closely but require more computation. Shorter filters do not approximate the ideal RRC as well but require less computation. Typically, one will choose a ...


2

Classic filteration is indeed done using convolution. Though I have seen broader definition of filtering as shaping the signal in its frequency domain which can be done in many other methods as well. Of course you can create meaningful operations using element wise operations and even specifically multiplication. Think of the case you have a noise with the ...


2

I'm not a Ruby programmer, so there will be a lot of handwaving in this answer. If you are particularly concerned about skipped details, you'll have to look in the Ruby source code. In array.sort {|a,b| a <=> b}, the sort method of array is being called with a block { ... }. The arguments used by the block are given by |a,b|. The comparison "spaceship"...


2

Actually we are also facing the same problem, instead of (Z,P,k), even if you use (A,B,C,D), as soon as sos will come in syntax with g, your magnitude response will scaled by the attenuation factor. If you are concerned only with plotting magnitude response you can plot as freqz(sos) you will get exact magnitude response without scaling.


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