Quote:
Originally Posted by khatamidk
...
|
David,
If I am reading this correctly, you are doing the following:
1) Using GetRate() to grab the "instantaneous" (consecutive-count) rate from the FPGA, and then
2) shifting all the values in an array to make room for this new datum (and dropping the oldest datum from the arrary, and then
3) sorting the whole array, and then
4) picking the median value from the middle of the array.
Have you tried any of the suggestions in earlier posts in this thread, such as:
a) Instead of using GetRate(), read the encoder counts instead, and divide by the sampling time (as explained in post39), or
b) Use a simple IIR filter (as shown in post37), or
c) Use an efficient FIR moving-window average filter (post37)?