Quote:
Originally Posted by sheleski
Chris,
Would you be willing to post in Labview example using a HPF and a gyro?
Steven
|
See attached image.
The equation for a high pass filter is:
Output = Input - Input_previous_sample + FilterConstant * Output_previous_sample
FilterConstant = exp(-SamplePeriod / TimeConstant)
In the attached vi, I have FilterConstant being calculated every sample, which is very inefficient if you are running the filter in a loop with a constant sample period (like TimedTasks.vi). If you are running it in a constant-time loop, replace the entire part inside the frame "Filter Constant calculation" with a simple constant.
Example filter constant calculation: if you're running in the 10 ms loop (SamplePeriod = 0.01 since 10 ms is 0.01 seconds) and you want your time constant to be 30 seconds, then the filter constant is:
FilterConstant = exp(-0.01 / 30) = 0.9996667222
Edit: I forgot to initialize one of the feedback nodes to zero. It should be zero by default, but I like to be explicit.