% FUNCTION ma TO COMPUTE MOVING AVERAGE
function result = ma(d, w)
result = cumsum([sum(d(1:w)); d(1+w:end) - d(1:end-w)])/w;
end
