可以用以下程序计算7天的平均值,7天是指从测量天前3天到其后3天。
Weekly value is the average value in 7 days from 3 days before and 3 days after measurement day.
% calculate weekly ET and SM function V_running = Weekly_running(ET) V_running=zeros(length(ET),1); for p=1:length(ET) if (p<3+1) % the former three V_running(p)=nanmean(ET((p-(p-1)):(p+(p-1)))); elseif (p>=length(ET)-3) % the backer three V_running(p)=nanmean(ET((p-(length(ET)-p)):(p+(length(ET)-p)))); else V_running(p)=nanmean(ET((p-3):(p+3))); end end