If I have this kind of data:
SeedRandom[2912018];
x = RandomReal[{0, 5}, 100];
y = RandomReal[{0, 1}, 100];
ListPlot[Transpose[{x, y}], AspectRatio -> Automatic, Frame -> True,
FrameLabel -> {"x", "y"}]
How can I apply MovingAverage
to continously smooth the y
data along x
with an interval width of dx = 0.5
? The variation step of dx
should be 0.1
.
The x intervals
would be:
[0.0, 0.5]
[0.1, 0.6]
[0.2, 0.7]
...
[4.3, 4.8]
[4.4, 4.9]
[4.5, 5.0]
So for the first x
interval [0.0, 0.5]
the average of all y
values (=yaverage1
) in this range would result into the point {(0.0 + 0.5)/2, yaverage1}
etc. The last x
value of the averaged data would be at (4.5 +5.0)/2
.