How to circ_mean every 5 elements?

15 ビュー (過去 30 日間)
MrGreenill
MrGreenill 2021 年 2 月 10 日
回答済み: Mathieu NOE 2021 年 2 月 10 日
I have a 320x15 vector, which I want to reduce to 64x15 by getting the circ_mean of every 5 elements down each column. Is there a way to do this?

採用された回答

Mathieu NOE
Mathieu NOE 2021 年 2 月 10 日
hello
demo code below :
% dummy data
data = rand(320,15);
buffer = 5; % nb of samples for averaging
% zero overlap mean averaging
[m,n] = size(data)
for ci=1:fix(length(data)/ buffer)
start_index = 1+(ci-1)*buffer;
stop_index = min(start_index+ buffer,length(data));
time_index(ci) = round((start_index+stop_index)/2); % time index expressed as sample unit (dt = 1 in this simulation)
avg_data(ci,:) =mean(data(start_index:stop_index,:)); %
end
figure(1),
plot(time_index,avg_data);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by