How to 'smooth' data and calculate line gradient?

后端 未结 6 1439
执念已碎
执念已碎 2020-12-24 03:39

I\'m reading data from a device which measures distance. My sample rate is high so that I can measure large changes in distance (i.e. velocity) but this means that, when the

6条回答
  •  悲哀的现实
    2020-12-24 04:45

    You need a smoothing filter, the simplest would be a "moving average": just calculate the average of the last n points.

    The question here is, how to determine n, can you tell us more about your application?

    (There are other, more complicated filters. They vary on how they preserve the input data. A good list is in Wikipedia)

    Edit!: For 10Hz, average the last 100 values.

提交回复
热议问题