Question: ME 0 2 1 - Engineering Computing - Fall 2 0 2 4 Assignment HW 0 3 b Moving Averages Moving averages are a way

ME021- Engineering Computing - Fall 2024
Assignment HW 03b
"Moving Averages"
Moving averages are a way of filtering data, often used to "smooth" spikes or random fluctuations in the data.
There are several methods of generating a moving average from a raw data set. For our purposes, the moving
average at an index will be the average of the data at that index and the data within an "index radius" (or
sometimes "window half-size") of that data. The radius can generally be any non-negative integer. If the radius is
0, then the moving average is the same as the data, because we are averaging that data point with that 0 points
before and after it. With a radius of 1, each moving average point would be the data at that point averaged with
the data one point before and one point after it. Et cetera.
Obvious question: What do we do near the first and last points in the data set, where the radius would have us
include data points in the average that aren't in the data? For example, with a radius of 2, the moving average for
the first data point should include that data point averaged with the two points before it and two points after it.
But, there aren't two points before it. And, for the second data point, there is only one point before it, so there is
no way to use the two points before it. A similar issue would exist for the last two data points in the set. For our
purposes, we do not average in points that are not in the data set, just using those that are.
An example moving average for a set of 10 data points using a radius of 2 is shown below, along with the details
of how the calculations are done. Notice that the averages for the first two and last two points are calculated
differently, as explained above.
ME 0 2 1 - Engineering Computing - Fall 2 0 2 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!