V
V
vipermagi2018-11-06 00:01:27
Mathematics
vipermagi, 2018-11-06 00:01:27

How to smooth the sensor data array?

The heart rate value gets onto the real-time graph every about 20 seconds.
If you compress the graph, it looks like this picture (thick dots): https
img-bIvSFY.png://studfiles.net/html/2706/610/html_hMN5gcGvO...
can give the same result as the thickest line (ss_i) in this picture? Well, that is, I want the smoothed graph to be drawn neatly in the middle of the river from the dots.
The supsmooth(x,y) function is described as: "returns an n-dimensional vector of smoothed VYs computed using k-nearest neighbors linear least squares smoothing with an adaptive choice of k. Gaussian. VX and VY are n-dimensional vectors real numbers. The elements of the vector VX must go in ascending order."
So far I have seen only mathematical formulas on this topic, without code. Or with code, but not quite about that. And I really don't want to spend a lot of time, because I just need one function for a two-dimensional graph.
Or maybe I don’t need this, but there is something that gives a better result or is suitable for real time.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Olohtonov, 2018-11-06
@sgjurano

Take just the average for some period, for example, for a second.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question