Double Sided Moving Average

7 ビュー (過去 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 Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by