Tag Info

18

For digital notch filters, I like to use the following form for a notch filter at DC ( $\omega$=0): $$H(z) = \frac{1+a}{2}\frac{(z-1)}{(z-a)}$$ where $a$ is a real positive number < 1. The closer $a$ is to 1, the tighter the notch (and the more digital precision needed to implement). This is of the form with a zero = 1, and a pole = $a$, where $a$ is ...

15

The given single-pole IIR filter is also called exponentially weighted moving average (EWMA) filter, and it is defined by the following difference equation: $$y[n]=\alpha x[n]+(1-\alpha)y[n-1],\qquad 0<\alpha<1\tag{1}$$ Its transfer function is $$H(z)=\frac{\alpha}{1-(1-\alpha)z^{-1}}\tag{2}$$ The exact formula for the required value of $\alpha$ ...

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

12

If you remove (for the time being) that leading factor $A$ as a constant gain factor: $$H(s)=\frac{s^2+\left(\frac{\sqrt{A}}{Q}\right)s + A}{As^2 + \left(\frac{\sqrt{A}}{Q}\right)s + 1}$$ what you get then is a symmetric, but otherwise general shelf that could be equally described as "LowShelf" or "HighShelf". In dB, the gain at the low ...

11

To be able to analyze what a low pass filter does first you would need to understand what a Fourier transform is, hence some theory first. The Fourier transform essentially represents the time-domain information stored in some function (a square wave in your case) in terms of frequencies. A simple example would be a sine wave $sin(2\pi f_{c} t)$ which ...

10

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

10

You should not be using the analog filter - use a digital filter instead. You want the filter to be defined in Z-domain, not S-domain. Also, you should define the time vector with known sampling frequency to avoid any confusion. The design of the digital filter requires cut-off frequency to be normalized by fs/2. Here is a working example: import numpy as ...

9

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 $... 9 This answer provides a quick introduction to decimation concepts and CIC filters which I would consider as one solution given the description. Bottom Line First Given your use of a microcontroller, (implied emphasis on minimizing resources), and that you indicated you do not need a high performance filter- consider doing everything with Cascade-Integrator-... 9 I don't get your downsample step when you downsampled by factor$M$. Let me go from scratch with the spectrum visualization below, with time domain, continuous frequency domain and discrete frequency domain from left to right. When we reduce the sampling frequency by a factor$k$, the signal spectrum is copied to new replicas at$f_s/k$. The discrete ... 9 I'm new, so I can't add this comment to Matt L.'s answer. It is not an exponential filter, the equation is actually: $$y[n] \ = \ \alpha \, x[n] \ + \ ( 1 - \alpha ) \, x[n-1]$$ So it is a very short FIR filter, not an IIR filter. I'm not expert enough to know a specific name. Ced ============================================= Followup: I want to ... 8$E_1=E_{10}sin (\omega t)E_2=E_{20}sin (\omega t + \delta)E_{\theta} = E_1 + E_2 = E_{\theta0}sin (\omega t + \phi )$This can be described as the figure below: Now given the$E_{\theta 0}$, you can rotate$E_1$and$E_2$arbitrarily as long as$E_1$,$E_2$, and$E_{\theta 0}$form the triangular. As a result, your given sine wave can be ... 8 Two exact sine waves of the same frequency but different phases sum to another exact sine wave. That resultant sine wave can be decomposed into an infinite numbers of pairs (or any other greater number) of sine waves of the same frequency, not just the two original ones. Thus more information is required to reduce the possible solution space below infinite.... 8 Yes. This looks like it's a typical first order low pass. The time constant can be determined by looking at the time it takes for the falling edge to drop to 37% of the max amplitude ($e^{-1}$). The cutoff frequency of the low pass filter is$1/(2 \cdot \pi \cdot t_c)$where$t_c$is the time constant 8 The Kalman filter is the optimal filter under various assumptions. You need to check whether those assumptions hold in your case: a) the model perfectly matches the real system, b) the entering noise is white and Gaussian and c) the covariances of the noise are exactly known. Without further detail I can't say whether your statement My experiments ... 8 That formula for the cut-off frequency is a very inaccurate approximation. In this answer I derived the exact relation between the coefficient of a first order recursive averaging filter and its 3-dB cut-off frequency. Note that in the quoted answer I used the constant$\alpha=1-b$. From formula$(3)$in that answer we get for the coefficient$b$$$b = 2-\... 8 Consider a sequence of numbers x = [1, 100, 1, 100, 1, 100] If we send this sequence through an averaging transformation y(i) = 0.6*x(i) + 0.4*x(i-1) we get y = [1, 60.4, 40.6, 60.4, 40.6, 60.4] Original signal x had a lot of sudden changes 1 -> 100, 100 -> 1 where as signal y has smaller changes 60 -> 40, 40 -> 60 When we say that a ... 7 If you are looking for a frequency-independent delay applied to any given input signal by the filter (apart from amplifying and attenuating certain frequency components), then you won't be able to find it because there is no such delay. As you can see in your plots, group delay and phase delay are generally frequency dependent. Furthermore, for general input ... 7 Typically the advantages of an FIR filter are that it is easy to obtain a linear phase response, and numerical stability is not normally a problem. An IIR filter typically requires fewer taps (as you have observed), so is more efficient computationally, but the phase response tends to be somewhat erratic, and numerical stability is more likely to be an ... 7 In the s-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 ... 7 Kalman filters really aren't that special, and you seem to be missing the point of a Kalman filter. A Kalman filter is really just a generally time-varying, generally IIR, generally multi-input multi-output filter that's been designed using a specific procedure. Can we deem that traditional filters such as FIR and low-pass filter are designed to be used ... 6 I am generating my waves in a "Raw" mathematical way, meaning that i am creating a ramp for a saw wave and my square wave consists of pure 1's and 0's. The issue is that this technique is inherently not band limited. I would like to implement low pass filter into the algorithm in order to filter of the harmonic being generated that are higher than the ... 6 Let us say your sample rate is 48kHz. You are generating a sawtooth wave at a fundamental frequency of 10kHz, using your code. First harmonic is at 10kHz. Second harmonic at 20kHz. Third harmonic at 30kHz. But since your signal is inherently sampled at 48kHz, anything above Nyquist gets aliased back into the 0..24kHz band. The 30kHz harmonic is 6kHz above ... 6 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 ... 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 A low pass filter has a frequency response that satisfies $$|H(\omega)|\approx 0,\quad |\omega|>\omega_c\tag{1}$$ where$\omega_c\$ is the cut-off frequency. A complex low pass filter must also satisfy $$H(\omega)\neq H^*(-\omega)\tag{2}$$ which causes its impulse response to be complex-valued. So the frequency response of a complex low pass filter is ...

6

Filters do have a delay (a lag) since they do not act immediately on your signal. Also all samples before the time 0 are zeros, thus in general you will start from the "zero mark", as you said (just imagine your filter equation with all zeros). There are ways to make a filter to have a zero lag. It is done by so called zero-phase filtering, also known as ...

6

In principle you can, in practice you almost can. The square wave consits of sinusoids with frequencies that are at multiples of the fundamental one (the inverse of the length of one high and one low). These are called harmonics, as you already seem to know. The low pass filter can remove all frequencies above the fundamental one, and you are left with only ...

6

I think it happens due to 2 things: Quantization You are working using UINT8 Image, try convert it into floating Point Image. You may do this by mO = im2double(mI) where mI is the UINT8 and mO is a floating point image in the range [0, 1]. You may also do it using mO = double(mI) / 255. Gaussian Kernel Radius vs STD Ratio Your Gaussian Filter Radius is 12 ...

6

Non-linearity A linear filter is mathematically described by the convolution sum (for discrete signals) and the convolution integral for continuous signals. The median cannot be found using a linear function except in the trivial case where you have a discrete filter of size 1, which is why the median filter is non-linear. Edge Preserving Properties. ...

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