Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档
资料存档 资料存档
回复
 
主题工具 显示模式
旧 2019-12-10, 20:42   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
帖子 八度时间序列移动平均值

我有一个矩阵,每列代表一段时间内的特征。我需要找到给定窗口大小的这些值的移动平均值。

有没有像一个功能一个在MATLAB?

output = tsmovavg(vector, 's', lag, dim)

回答:

您可以使用FILTER功能。一个例子:

t = (0:.001:1)'; %#' vector = sin(2*pi*t) + 0.2*randn(size(t)); %# time series wndw = 10; %# sliding window size output1 = filter(ones(wndw,1)/wndw, 1, vector); %# moving average 甚至使用映像包中的IMFILTERFSPECIAL

output2 = imfilter(vector, fspecial('average', [wndw 1])); 最后一种选择是使用索引编制(不建议用于非常大的向量)

%# get indices of each sliding window idx = bsxfun(@plus, (1:wndw)', 0:length(vector)-wndw); %'# compute average of each output3 = mean(vector(idx),1); 请注意填充的区别: output1(wndw:end)对应于output3



更多&回答...
poster 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码



所有时间均为北京时间。现在的时间是 01:19


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.