Downsampling by Averaging in Blocks
19 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Farooq Wahab
il 5 Mar 2016
Risposto: Andrei Bobrov
il 5 Mar 2016
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 Commenti
Risposta accettata
Andrei Bobrov
il 5 Mar 2016
y=[1,2,3,4,5,6,7,8,9,10,11];
out = nanmean(reshape([y(:); nan(mod(-numel(y),4),1)],4,[]));
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Multirate Signal Processing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!