Downsampling by Averaging in Blocks
17 ビュー (過去 30 日間)
古いコメントを表示
Hello, I would like to downsample data simulated at 200 Hz to 50 Hz by averaging blocks of 4 and plot it versus time. For example, if y=[1,2,3,4,5,6,7,8,9,10,11,......], I would like to do averages of (1,2,3,4), then (5,6,7,8), and so and plot it versus t=[0:1/50:60], so that the downsampled data appears to be sampled at 50 Hz. The MATLAB downsample function seems to downsample by removing the data points. http://www.mathworks.com/help/signal/ref/downsample.html
Thanks.
0 件のコメント
採用された回答
Andrei Bobrov
2016 年 3 月 5 日
y=[1,2,3,4,5,6,7,8,9,10,11];
out = nanmean(reshape([y(:); nan(mod(-numel(y),4),1)],4,[]));
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Multirate Signal Processing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!