Double Sided Moving Average

10 次查看(过去 30 天)
James Gay
James Gay 2020-8-26
编辑: Matt J 2020-8-26
Hello, I am trying to create a double sided moving average of my data that averages 9-points or whatever is avalible. Here is my code for the averaging so far.
ColitisMean = movmean (d2Colitis, [8 0]) ;
PColitisMean = plot (xRawColitis, ColitisMean, 'red'), hold on;
ControlMean = movmean (d2Control, [8 0]);
PControlMean = plot (xRawControl, ControlMean, 'blue') ;
set (gca, 'xdir', 'reverse');
xlim([400 4000]);
xlabel ('wavelength cm^-^1');
ylabel ('Averaged Second Derivative');
legend ({'Colitis', 'Control'}, 'Location', 'best') ;
I am trying to figure out how to get it to follow the pattern of
Y = (a,b,c,d,e,f,g,h……..z) (i.e. total set of data =26) <- original data
Y’ = (a’, b’, c’, d’, …… z’) <- what I am trying to get to
a’ = (a), b’ = (a+b+c)/3, c’ = (a+b+c+d+e)/5, d’ = (a+b+c+d+e+f+g)/7, e’ = (a+b+c+d+e+f+g+h+i)/9, f’ = (b+c+d+e+f+g+h+i+j)/9, ………… q’ = (m+n+o+p+q+r+s+t+u)/9, r’ = (n+o+p+q+r+s+t+u+v)/9, …………, v’ = (r+s+t+u+v+w+x+y+z)/9, w’ = (t+u+v+w+x+y+z)/7…….. y’ = (x+y+z)/3, z’ =z
. <- how I am trying to get there

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by