nabla101
Junior Member level 3
- Joined
- Feb 8, 2011
- Messages
- 30
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,600
Hi,
I am taking recorded measurement data sampled at 8ms (125Hz) and using a library Software function for a low pass filter built into the measurement program.
I have looked at the code of the function, and it uses a parameter, a, ("smoothing factor") where 0 < a < 1, and a = 1 means no filtering, I have managed to write a difference equation and the transfer function for the filter in the z-domain based on the code:
y[n] = (1-a)y[n-1] + a*x[n]
where y[n] and x[n] are current output and input. From which I got the transfer function:
H(z) = a / (1 + (a - 1)*z^(-1) )
I can reduce the value of a towards zero, and see the software function perform filtering, but what I want to be able to do is to specify a -3dB cut-off frequency in HERTZ, e.g. 1kHz, 2kHz, and use this as an input to the function instead of the "smoothing factor", a. (Or at least be able to convert from a frequency in Hz to the parameter a, which I can then use in the function)
I have been reading lots of stuff on digital filters, and found a formula that relates a to cut-off frequency, for a low-pass filter of this type, which was:
a = e^(-2*Pi*f_c)
View attachment dsp_book_Ch19.pdf
but it says that f_c must be between 0 and 0.5, I want to input a value in Hz - If I try to use this formula with for example 1kHz cut-off it just tells me to set the smoothing factor to zero because of the exponential function.
I also read I might need to use an inverse bilinear transform to transform to the s-domain, and use a 'frequency warping' formula, which will all depend on the sampling frequency.
Assuming my sampling frequency is fixed, what is the easiest way for me to go about this?
Thanks
(attached .pdf with that formula)
I am taking recorded measurement data sampled at 8ms (125Hz) and using a library Software function for a low pass filter built into the measurement program.
I have looked at the code of the function, and it uses a parameter, a, ("smoothing factor") where 0 < a < 1, and a = 1 means no filtering, I have managed to write a difference equation and the transfer function for the filter in the z-domain based on the code:
y[n] = (1-a)y[n-1] + a*x[n]
where y[n] and x[n] are current output and input. From which I got the transfer function:
H(z) = a / (1 + (a - 1)*z^(-1) )
I can reduce the value of a towards zero, and see the software function perform filtering, but what I want to be able to do is to specify a -3dB cut-off frequency in HERTZ, e.g. 1kHz, 2kHz, and use this as an input to the function instead of the "smoothing factor", a. (Or at least be able to convert from a frequency in Hz to the parameter a, which I can then use in the function)
I have been reading lots of stuff on digital filters, and found a formula that relates a to cut-off frequency, for a low-pass filter of this type, which was:
a = e^(-2*Pi*f_c)
View attachment dsp_book_Ch19.pdf
but it says that f_c must be between 0 and 0.5, I want to input a value in Hz - If I try to use this formula with for example 1kHz cut-off it just tells me to set the smoothing factor to zero because of the exponential function.
I also read I might need to use an inverse bilinear transform to transform to the s-domain, and use a 'frequency warping' formula, which will all depend on the sampling frequency.
Assuming my sampling frequency is fixed, what is the easiest way for me to go about this?
Thanks
(attached .pdf with that formula)