A moving average of a data set x = {x1, x2, x3, x4, …, xn} is defined as a set of averages of subsets of the original data set. For example, a moving average of every two terms would be 1/2 *{x1+ x2, x2+ x3, x3 + x4, …, xn-1 + xn}
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:14| Question number:5.14
All Answers
total answers (1)
moveAve2.m
function moveave = moveAve2(vec)
% Calculates the moving average of every 2
% elements of a vector
% Format of call: moveAve2(vector)
% Returns the moving average of every 2 elements
firstpart = vec(1:end-1);
secondpart = vec(2:end);
moveave = 0.5 * (firstpart + secondpart);
end
Eliminating or reducing noise is an important aspect of any signal
processing. For example, in image processing noise can blur an
image. One method of handling this is called median filtering.
need an explanation for this answer? contact us directly to get an explanation for this answer