- #1
preimmortal
- 13
- 0
Hi Everyone,
I read an article by Barry L. Dorr about how to implement a Low Pass Filter in software, however, the equation that he gave confused me as I didn't see any sort of convergence to the value desired.
So here is the equation:
y(n) = (1 - 2^(-k)) * y(n-1) + x(n)
x is the input, y is the output, n is the index, and k is the filter strength
So I understand how k works as it just makes it so that previous values affect the output less. But where I run into problems is the + x(n) term.
So taking the example where k = 4, I have the equation:
y(n) = 0.9375 * y(n-1) + x(n)
Then I will just create an arbitrary array with which I want to low-pass and smooth out.
So let's say, x(n) = {1, 5, 3, 2}
Then that means,
y(3) = .9375 * y(2) + x(3) = 8.031 + 2 = 10.031
y(2) = .9375 * y(1) + x(2) = 5.5664 + 3 = 8.5664
y(1) = .9375 * y(0) + x(1) = .9375 + 5 = 5.9375
y(0) = x(0) = 1
So at this point, I can see the the output array is not even converging to getting larger as time goes on, even though the maximum input to low-pass filter was 5.
Any insight on how this works would be great.
I read an article by Barry L. Dorr about how to implement a Low Pass Filter in software, however, the equation that he gave confused me as I didn't see any sort of convergence to the value desired.
So here is the equation:
y(n) = (1 - 2^(-k)) * y(n-1) + x(n)
x is the input, y is the output, n is the index, and k is the filter strength
So I understand how k works as it just makes it so that previous values affect the output less. But where I run into problems is the + x(n) term.
So taking the example where k = 4, I have the equation:
y(n) = 0.9375 * y(n-1) + x(n)
Then I will just create an arbitrary array with which I want to low-pass and smooth out.
So let's say, x(n) = {1, 5, 3, 2}
Then that means,
y(3) = .9375 * y(2) + x(3) = 8.031 + 2 = 10.031
y(2) = .9375 * y(1) + x(2) = 5.5664 + 3 = 8.5664
y(1) = .9375 * y(0) + x(1) = .9375 + 5 = 5.9375
y(0) = x(0) = 1
So at this point, I can see the the output array is not even converging to getting larger as time goes on, even though the maximum input to low-pass filter was 5.
Any insight on how this works would be great.