Double Sided Moving Average

조회 수: 6 (최근 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