Decrease a size of matrix using interpolation

5 ビュー (過去 30 日間)
Ozan Carikci
Ozan Carikci 2021 年 1 月 31 日
回答済み: Mathieu NOE 2021 年 2 月 1 日
Good evening everyone,
I have a matrix with 108064 x 2 size. I want to decrease its size to aproximately 2000 using interpolation. Thus, if we consider this matrix as cells and my plan is to see every 64 data like one data with using interpolation and it is going to be around 1600 cells. How can i implement it on Matlab. Thank you. Sincerely...
  2 件のコメント
John D'Errico
John D'Errico 2021 年 1 月 31 日
That is not interpolation, but a downsizing. It sounds like you just want to average every 64 elements, a far different thing than interpolation.
Ozan Carikci
Ozan Carikci 2021 年 1 月 31 日
Yes i want to take average of every 64 elements, how can i do downsizing on a matrix 108064 x 2 size?

サインインしてコメントする。

回答 (1 件)

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

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by