Question: ENGR 40 Moving Average Program When a plot is made from experimental data, sometimes the scatter of the data points is such that it is

 ENGR 40 Moving Average Program When a plot is made from

ENGR 40 Moving Average Program When a plot is made from experimental data, sometimes the scatter of the data points is such that it is difficult to select a "best representative curve" for the plot. In such a case, the data can be adjusted to reduce the scatter by using a "moving average" mathematical method. Under this method each data point of the original set (except for the first and last) is replaced by the average of three points: itself, the point before it, and the point after it. Write a function that will accept an array of data values and "smooth" the data using the moving average method. The parameters passed to the function should be an array of original data values (double type), an empty array (double type) that will be filled with the smoothed data values, and an integer representing the number of data values in the passed array. Protect the original array from being able to be changed by the function. Use the following driver program to test your function. Turn in a copy of your function, the main program that called it, and the output. #include #includeiomanip> void moving average(const double x[ ], double yl 1. int n); using namespace std; int main const int N = 20; const double p[N]-(1.2,5.3, 19.0, 35.6,40.2, 48.7, 80.6, 99.9,100.0, 112.5, 122.7, 127.7, 138.2, 150.2, 153.6, 175.8, 181.2, 188.7,210.0,215.3) double t[N] int n, k; n-20; cout

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 Databases Questions!