creating array with specific condition

조회 수: 1 (최근 30일)
sermet OGUTCU
sermet OGUTCU 2021년 12월 28일
답변: sermet OGUTCU 2021년 12월 29일
data= 689 x 1
% moving average values for the last 50 data
data_average(1)= mean(data(1));
data_average(2)= mean(data(1:2));
data_average(50)= mean(data(1:50));
.
data_average(51)= mean(data(2:51));
data_average(52)= mean(data(3:52));
.
data_average(689)=mean(data(640:689));
How I can vectorize this computation?

채택된 답변

Walter Roberson
Walter Roberson 2021년 12월 28일

추가 답변 (1개)

sermet OGUTCU
sermet OGUTCU 2021년 12월 29일
Dear Walter, thank you very much for the solution.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by