3) [19 points] This problem will return to the data


Transcribed Image Text:

3) [19 points] This problem will return to the data from the previous assignments analyzing reactor temperature measurements. Nate the excessive variability (or noise) in the data. This variability can make it difficult to interpret the data. A simple approach to reduce the variability is to calculate a moving average, which will "smooth" the data. For this problem, the smoothed data will be the average of three data points: the data at the current time and the data from the previous two times. For instance, in the sample data given to you, the smoothed value at time 19 is the average of the data at 17, 18 and 19 minutes. The calculation is shown below: (255.847 + 255.937 + 255.312) 255.699 = At the beginning of the data set there will be fewer data values than the number used in the averaging. In this case, the smoothed temperature is the average of all available data points. In the example, the smoothed data for minute 1 is the raw data and the smoothed value for minute 2 is the average of data at minutes 1 and 2. a) [14 points] Write a program that will input the raw (unsmoothed) data and output the smoothed data to the spreadsheet as shown in the example. The program should be able to work on data sets of any length (and not just the 22 data points in the example data). 1 s datapoints 3 time data smooth 1 255.243 255.243 2. 255.936 255.590 255.797 255.659 4 255.861 255.865 5 255.193 6 255.947 255.667 7. 255.681 255.607 255,617 10 11 255.842 255.824 12 255.124 255.549 13 10 255.516 255.494 14 11 255.246 255.295 15 12 255.719 255.494 16 13 255.067 255.344 17 14 255.811 255.532 18 15 255.006 255.294 255.410 16 255.413 17 | 255.312 18 255.937 255.554 19 255,847255.699 19 20 255.244 21 22 23 20 255.503 255.762 24 21 255.829 255.726 22 255.983 255.771 b) [5 points] Copy your program from part a). Modify it so the user can enter the # of data points to be averaged at each time step. The figure below shows an example where 4 values are averaged. Note in the example that the data for the first three minutes are the averages of all available data to that point, A # datapoints User enters number of data points to be averaged for each minute. 3 time data smooth 1 255.243 255.243 255.936 Average of data at minutes 1 and 2 Average of data at minutes 1, 2 and 3 255.590 255.797 255.659 4. 255.861 255.709 255.193 255.697 6. 255.947 255.699 10 7 255.681 255.670 Four minutes of data averaged. Smoothed data at minute 9 is calculated from the average of raw data from minutes 6,7,8, and 9. 11 8. 255.842 255.666 255.649) 255.516 255.541 12 255.124 - 13 11 12 17