|Low-pass filter has been listed as a level-5 vital article in Technology. If you can improve it, please do. This article has been rated as C-Class.|
|This article is of interest to the following WikiProjects:|
This page is archived by ClueBot III.
Discrete-time realization - How to derive the formula "(1-alpha)"?
How do you get from this:
- It is simple algebra. Try working backwards, which has a more straightforward substitution. That is, substitute the expression for α into the second expression and the result should be the first expression. SpinningSpark 10:13, 30 September 2012 (UTC)
- I tried working backwards but I still can't do it. I end up with two on the right hand side in the 2nd equation, but there is only one in the first equation. Can someone please show the steps to derive the "(1-α)" part. I'm also confused why it is -alpha instead of +alpha, when there are no negative terms in the first equation.--22.214.171.124 (talk) 13:45, 30 September 2012 (UTC)
- We wish to show that,
- dividing top and bottom of the LHS by RC,
- From the definition of α, and dividing top and bottom by ΔT,
- Substituting Eq. 4 into Eq. 2,
Ah that's great, thanks! I think I understand now. The key point is your Equation #3. There may be an easier way to derive (1-alpha) without working backwards:
... Equation 6
Now from Equation 3:
Rearrange Eqution 3:
... Equation 7
Substitute Equation 7 into equation 6:
Should this derivation be included in the article?
High attention cross reference needed?
- Don't see any particularly good reason for that, I have reverted it. Not sure we need it as a see also at all, it is already in the navbox at the bottom and is linked from the lede of the article. SpinningSpark 18:58, 24 December 2013 (UTC)
function lowpass(real[0..n] x, real dt, real RC)
var real[0..n] y var real α := dt / (RC + dt) y := α * x for i from 1 to n y[i] := α * x[i] + (1-α) * y[i-1] return y
Shouldn't it be:
function lowpass(real[0..n] x, real dt, real RC)
var real[0..n] y var real α := dt / (RC + dt) y := x for i from 1 to n y[i] := α * x[i] + (1-α) * y[i-1] return y — Preceding unsigned comment added by 126.96.36.199 (talk) 22:18, 12 April 2020 (UTC)
A more commonly accepted difference equation
My interest in this article stems from my participation in the Ardupilot project which implements a digital low-pass filter according to the "Discrete-time realization" section of this article. I immediately noticed that it disagreed with every other implementation I had encountered.
I have added several sections to derive the more commonly accepted difference equation for the low pass filter. I will be adding an "Error Analysis" section which appears to be missing from the current "Discrete-time realization" section. The major difference between the two difference equations is the value of α = ωT/(ωT + 1) vs. β = exp(-ωT). It should be noted that using β in the difference equation yields an exact reconstruction of the step response whereas using α yields an error based on the corner frequency, ω, and the sampling interval, T, making β more desirable.
One problem I am having is that I am not able to upload pictures to the article. It keeps complaining that it can't verify the picture's integrity or something like that. I would like to upload the Time Response graph of the low-pass filter so if anyone can help me with that I would appreciate it.
- I emailed you about how I might help on image upload. Or just say more here about what problem you are seeing. On the article changes, it would be nice to see a better integration, instead of duplicating a lot of stuff with a modified approach. I'm familiar with the impulse invariance method, but not with a step invariance method; is that an approach that you have sources on? Ah, yes, it is; here. I believe your result is also what one would get by the Matched Z-transform method, at least for this filter if not more generally. Dicklyon (talk) 19:25, 24 July 2020 (UTC)
- Excellent link! I did not know the name of the step invariance method. Doing a Google search I found this paper on step and ramp invariant filters. If I have time, I may attempt the ramp invariant solution. For now, I will add a small error analysis section then move on to multiple pole analysis. Thanks for your input! One more concern, since we know that the "Discrete-time realization" section's difference equation is less accurate, should we challenge or delete that section? --Kraybill (talk) 21:02, 27 July 2020 (UTC)
- I should put some math behind my statement: Let's call the 2 methods α and β after their respective constants. Both have the same overall form so the only difference between them is the value of α vs. the value of β. Let's evaluate β first. The error is simply the difference between the step input time response, vout(t) = Vi(1 - exp(-ωt)), and the reconstructed output using the difference equation. We only need to evaluate the terms at t=T to determine the error. So the time response at t=T is Vi(1 - exp(-ωT)) which is equal to that of the β method yielding a 0% error for the β method. This should be no surprise since the β method was designed that way. On the other hand, at time t=T the α method produces a value of Vi*T/(RC + T) ≠ Vi(1 - exp(-ωT)). Since T > 0 there will always be an error in the reconstructed signal for the α method, hence the α method is always "less accurate". We can look at the α method as a low-pass filter with the wrong corner frequency! For example, with ω=2π (1 Hz) and T = 0.01 (100Hz) the α method yields an error of E = 100*(β - α)/β = 2.9%, whereas the β method yields 0% error. At minimum, the α section should be edited to point out the approximation xi - yi = RC y(i)-y(i-1)/T as xi - yi ≈ RC y(i)-y(i-1)/T, and include an expression for the difference equation's time response error. --Kraybill (talk) 15:29, 28 July 2020 (UTC)
- Matching the step response is one method. Matching the impulse response is a different method (which actually yields a pole and zero in this case, if done correctly). Depending in what you want to match, you get different results. I'm not sure of the properties of the other method described at present, but it might be doing something good. Dicklyon (talk) 15:46, 28 July 2020 (UTC)