Question: solve in python 5. Sample values from an experiment often need to be smoothed out. One approach is to replace each value with the mean
5. Sample values from an experiment often need to be smoothed out. One approach is to replace each value with the mean of the previous n values, this is called the simple moving average. Implement a function, smooth (values, n ) that carries out this operation. The variable values is a list of numbers and n is the size of the moving average. The function should return a new list with the smoothed data. The new list should have n1 fewer elements than the original list. For example, smooth ([3,5,1,5,6,8,9,10,15, 3], 3) should return [3.0,3.7,4.0,6.3,7.7,9.0,11.3,9.3]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
