Using movmean to calculate mean of first and last element in array
조회 수: 9 (최근 30일)
표시 이전 댓글
I have an array [1 5 8 10] and using movmean with window length [0 1] this gives me [3 6.5 9 10]. Is there a way in which I can use movmean to calculate the mean of 10 and 1 as well and add that in the fourth position of the array?
댓글 수: 0
채택된 답변
Ive J
2022년 3월 22일
What about this?
a = [1 5 8 10];
ma = movmean([a, a(1)], [0 1], 'Endpoints', 'discard')
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!